//
//  DanXiangDieaseViewController.m
//  MyYiJianKangApp
//
//  Created by 张国文 on 16/5/6.
//  Copyright © 2016年 hangzhouyijiyin. All rights reserved.
//

#import "DanXiangDieaseViewController.h"
#import "MCBarChartView.h"
#import "XYPieChart.h"
#import "KWFormView.h"
#import "JiYinJianCeJieGuoModel.h"
#import "WenXianCanKaoListViewController.h"
#import "ZGWBiaoGeXiangJieViewController.h"
#import "ZGWJiBingFengXianJiuZhengViewController.h"
#import "ZGWGeneListViewController.h"
#import "ZGWWebViewController.h"

#define kCurrentUserToken [[NSUserDefaults standardUserDefaults]objectForKey:@"token"]

@interface DanXiangDieaseViewController ()<MCBarChartViewDataSource, MCBarChartViewDelegate, XYPieChartDataSource, KWFormViewDataSource, KWFormViewDelegate>

@property (nonatomic, strong) UIScrollView *backGroundScrollview; // 背景滚动图

@property (nonatomic, strong) MCBarChartView *myZhuZhuangView;  // 柱状图

@property (nonatomic, strong) NSMutableArray *huanBingGaiLv; // 患病概率数组

@property (nonatomic, strong) XYPieChart *myBingZhuangView; // 饼状图

@property (nonatomic, strong) KWFormView *jiYinBiaoGe; // 基因表

@property (nonatomic, strong) NSMutableArray *jiYinBiaoGeArray; // 基因表数组

@property (nonatomic, strong) NSMutableArray *xiaoLianRectArray; // 笑脸位置

@property (nonatomic, strong) KWFormView *ranSeTiBiaoGe; // 染色体表格

@property (nonatomic, strong) NSMutableArray *ranSeTiImageWeiZhiArray; // 保存染色体位置

@property (nonatomic, strong) NSMutableArray *ranSeTiNameArray; // 染色体名字

@property (nonatomic, strong) NSMutableArray *qiTaZhiBingYinSuArray; // 其他致病因素数组

@property (nonatomic, strong) NSMutableArray *jianKangJianYiArray; // 健康建议的数组

@property (nonatomic, strong) NSString *diseaseIntroduceString; // 疾病介绍

@property (nonatomic, strong) MCBarChartView *jiuZhengFengXianZhiView; // 就正如风险值柱状图

@property (nonatomic, strong) NSMutableArray *jiuZhengZhiArray; // 纠正值数组

@property (nonatomic, assign) CGFloat jiuZhengFengXianJieShaoBottom; // 纠正风险值介绍底部

@property (nonatomic, strong) NSMutableArray *jiYinArray; // 示例报告的基因数据

@property (nonatomic, strong) NSString *imageUrl; // 图片url

@property (nonatomic, strong) NSMutableArray *jvXianXingArray; // 局限性数组

@property (nonatomic, strong) NSMutableArray *danXiangBiaoQianArray; // 单项标签的数组

@property (nonatomic, strong) NSTimer *myTimer; // 检查请求是否超时
@property (nonatomic, assign) NSInteger numberOfTime; // 存储请求时间

@end

@implementation DanXiangDieaseViewController

- (void)viewWillDisappear:(BOOL)animated
{
    [super viewWillDisappear:YES];
    // 关闭动画
    [[JiaZaiAnimationHandle shareJiaZaiAnimationHandle] stopAnimation];
    // 关闭计时器
    [self.myTimer invalidate];
    self.numberOfTime = 0;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.view.backgroundColor = [UIColor whiteColor];
    // navi的修改
    [self changeNavigation];
    
    if (self.isShiLiBaoGao == YES) {
        [self addGongGao];
        [self addData];
      
    } else {
        // 检查网络并建立数据源
        [self searchNetAndAddData];

    }
    
}

#pragma mark - 公告
- (void)addGongGao
{
    
    UIAlertController *alertVC = [UIAlertController alertControllerWithTitle:@"" message:@"我们以冠心病为例子进行展示，因此点击进入的所有单项都会跳转到该界面" preferredStyle:UIAlertControllerStyleAlert];
    // 修改message
    NSMutableAttributedString *messageString = [[NSMutableAttributedString alloc] initWithString:@"我们以冠心病为例子进行展示，因此点击进入的所有单项都会跳转到该界面"];
    [messageString addAttribute:NSForegroundColorAttributeName value:[UIColor blackColor] range:NSMakeRange(0, messageString.length)];
    [messageString addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:k17Big] range:NSMakeRange(0, messageString.length)];
    [alertVC setValue:messageString forKey:@"attributedMessage"];
    [self presentViewController:alertVC animated:YES completion:nil];
    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
        [self dismissViewControllerAnimated:YES completion:nil];
    });
}

#pragma mark - 检查网络并建立数据源
- (void)searchNetAndAddData
{
    if ([[[NetStatusHandle shareHandle] getNetStatus] isEqualToString:@"YES"]) {
        // 说明有网络
        // 建立数据源
        [self addData];
        // 建立计时器，计算是否超时
        self.myTimer = [NSTimer timerWithTimeInterval:1 target:self selector:@selector(goTimeOnShiLiBaoGaoDanXiang:) userInfo:nil repeats:YES];
        [[NSRunLoop currentRunLoop] addTimer:self.myTimer forMode:NSRunLoopCommonModes];
        self.numberOfTime = 0;
        
        // 开始动画
        [[JiaZaiAnimationHandle shareJiaZaiAnimationHandle] startAnimation];
    } else {
        NSLog(@"没有网络");
        // 添加提示框
        [[JiaZaiAnimationHandle shareJiaZaiAnimationHandle] addAlertTitle:@"通知" Content:kNoNetNoRefresh ToView:self];
    }
}

#pragma mark - 计时器
- (void)goTimeOnShiLiBaoGaoDanXiang:(NSTimer *)timer
{
    self.numberOfTime++;
    NSLog(@"示例报告单项界面时间= %ld", self.numberOfTime);
    if (self.numberOfTime > kZGWQingQiuChaoShi) {
        NSLog(@"示例报告单项界面请求超时");
        self.numberOfTime = 0;
        [self.myTimer invalidate];
        // 关闭动画
        [[JiaZaiAnimationHandle shareJiaZaiAnimationHandle] stopAnimation];
        // 添加提示框
        [[JiaZaiAnimationHandle shareJiaZaiAnimationHandle] addAlertTitle:@"通知" Content:kQingQiuChaoShiNoReFresh ToView:self];
    }
}

// 添加数据源
- (void)addData
{
    NSLog(@"疾病的名字:%@", self.zgwDiseaseOnShiLiBaoGaoModel.name);
    if (self.isShiLiBaoGao == YES) {
        self.navigationItem.title = @"冠心病";
        // 疾病介绍
        self.diseaseIntroduceString = @"     冠心病，古称胸痹，是一种最常见的心脏病，是指因冠状动脉狭窄、供血不足而引起的心肌机能障碍和(或)器质性病变，故又称缺血性心脏病(IHD)。症状表现胸腔中央发生一种压榨性的疼痛，并可迁延至颈、颔、手臂、后背及胃部。发作的其他可能症状有眩晕、气促、出汗、寒颤、恶心及昏厥。严重患者可能因为心力衰竭而死亡。";
        // 患病概率
        self.huanBingGaiLv = [NSMutableArray arrayWithObjects:@"0.77%", @"1.386%", nil];
        self.jiuZhengZhiArray = [NSMutableArray arrayWithObjects:@"0.77%", @"1.6%", nil];
        // 基因表数组
        self.jiYinArray = [NSMutableArray arrayWithObjects:@{@"name":@"CDKN2B-AS1", @"rs_pos":@"rs10757274", @"gene_type":@"A/A", @"influence":@"2", @"literature_count":@"1", @"gene_probility":@"29.2%", @"chrom":@"9p21.3", @"rs_id":@"rs10757274", @"location": @"9p21.3"}, @{@"name":@"CDKN2B-AS1", @"rs_pos":@"rs1333049", @"gene_type":@"G/G", @"influence":@"3", @"literature_count":@"1", @"gene_probility":@"25.0%", @"chrom":@"9p21.3", @"rs_id":@"rs1333049", @"location": @"9p21.3"}, @{@"name":@"LDLR", @"rs_pos":@"rs6511720", @"gene_type":@"G/T", @"influence":@"3", @"literature_count":@"1", @"gene_probility":@"7.5%", @"chrom":@"19", @"rs_id":@"rs6511720", @"location": @"19"}, @{@"name":@"MIA3", @"rs_pos":@"rs17465637", @"gene_type":@"C/C", @"influence":@"4", @"literature_count":@"1", @"gene_probility":@"0.5%", @"chrom":@"1q41", @"rs_id":@"rs17465637", @"location": @"1q41"}, @{@"name":@"PON1", @"rs_pos":@"rs854563", @"gene_type":@"G/G", @"influence":@"0", @"literature_count":@"1", @"gene_probility":@"4.0%", @"chrom":@"7", @"rs_id":@"rs854563", @"location": @"7"}, @{@"name":@"TCF21", @"rs_pos":@"rs12524865", @"gene_type":@"A/A", @"influence":@"2", @"literature_count":@"1", @"gene_probility":@"15.2%", @"chrom":@"6q23.2", @"rs_id":@"rs12524865", @"location": @"6q23.2"}, @{@"name":@"ADTRP", @"rs_pos":@"rs6903956", @"gene_type":@"A/A", @"influence":@"2", @"literature_count":@"1", @"gene_probility":@"51.6%", @"chrom":@"6p24.1", @"rs_id":@"rs6903956", @"location": @"6p24.1"}, @{@"name":@"ATP2B1", @"rs_pos":@"rs7136259", @"gene_type":@"C/T", @"influence":@"3", @"literature_count":@"1", @"gene_probility":@"23.8%", @"chrom":@"12q21.33", @"rs_id":@"rs7136259", @"location": @"12q21.33"}, @{@"name":@"PHACTR1", @"rs_pos":@"rs9349379", @"gene_type":@"A/A", @"influence":@"2", @"literature_count":@"1", @"gene_probility":@"17.5%", @"chrom":@"6p24.1", @"rs_id":@"rs9349379", @"location": @"6p24.1"}, @{@"name":@"---", @"rs_pos":@"rs10757278", @"gene_type":@"G/A", @"influence":@"1", @"literature_count":@"1", @"gene_probility":@"24.5%", @"chrom":@"9p21", @"rs_id":@"rs10757278", @"location": @"9p21"}, nil];
        self.jiYinBiaoGeArray = [NSMutableArray array];
        for (NSDictionary *tempDic in self.jiYinArray) {
            JiYinJianCeJieGuoModel *model = [[JiYinJianCeJieGuoModel alloc] init];
            [model setValuesForKeysWithDictionary:tempDic];
            [self.jiYinBiaoGeArray addObject:model];
        }
        
        // 保存表格详解笑脸位置
        self.xiaoLianRectArray = [NSMutableArray array];
        for (int i = 0; i < self.jiYinBiaoGeArray.count; i++) {
            
            CGFloat tempCount = 30  * kAdjustParamater + 38 * i * kAdjustParamater;
            [self.xiaoLianRectArray addObject:[NSNumber numberWithFloat:tempCount]];
        }
        
        // 染色体名字数组
        
        self.ranSeTiNameArray = [NSMutableArray arrayWithObjects:@"http://120.26.129.84/uploads/img/chr/png/chr1_10796866.png", @"http://120.26.129.84/uploads/img/chr/png/chr12_103234255.png", @"http://120.26.129.84/uploads/img/chr/png/chr16_56993324.png", @"http://120.26.129.84/uploads/img/chr/png/chr2_65595586.png", @"http://120.26.129.84/uploads/img/chr/png/chr6_150298842.png", @"http://120.26.129.84/uploads/img/chr/png/chr12_103234270.png", @"http://120.26.129.84/uploads/img/chr/png/chr16_56996288.png", @"http://120.26.129.84/uploads/img/chr/png/chr2_71525785.png", @"http://120.26.129.84/uploads/img/chr/png/chr6_151948366.png", @"http://120.26.129.84/uploads/img/chr/png/chrX_138632859.png", nil];
        // 染色体位置
        self.ranSeTiImageWeiZhiArray = [NSMutableArray array];
        for (int i = 0; i < self.jiYinBiaoGeArray.count; i++) {
            //  [self.ranSeTiNameArray addObject:@"ranseti-shilibaogao"];
            CGFloat tempHeight = 25 * kAdjustParamater + 38 * i * kAdjustParamater;
            [self.ranSeTiImageWeiZhiArray addObject:[NSNumber numberWithFloat:tempHeight]];
        }
        
        
        // 其他致病因素数组
        //  self.qiTaZhiBingYinSuArray = [NSMutableArray arrayWithObjects:@"1、高血压可以提高患病风险盎司偶见佛in为偶奇偶就走", @"2、抽烟可以提高患病风险", @"3、喝酒可以提高患病风险", @"4、心脏病、心血管疾病可以提高患病风险", nil];
        self.qiTaZhiBingYinSuArray = [NSMutableArray arrayWithObjects:@"1、遗传因素 ：家族遗传倾向是冠心病的一个不可控危险因素。冠心病虽不像其他遗传病那样具有显而易见的遗传性，但它却有明显的遗传倾向。对于具有明显遗传倾向的人群在暴露同等时间，同等程度的其他危险因素时，这些人群更容易患冠心病。研究发现有冠心病家族史的人群较无冠心病家族史的人群发生冠心病的危险性增加2.0—3.9倍，发生心肌梗塞的危险性增加2.2倍，而且冠心病的发生较无冠心病家族史的人群提前数年，冠脉病变的程度也更重。冠心病在有家族史的人群发生率高可能是基因作用其他危险因素的结果。", @"2、可改变的危险因素有：高血压，血脂异常（总胆固醇过高或低密度脂蛋白胆固醇过高、甘油三酯过高、高密度脂蛋白胆固醇过低）、超重/肥胖、高血糖/糖尿病，不良生活方式包括吸烟、不合理膳食（高脂肪、高胆固醇、高热量等）、缺少体力活动、过量饮酒，以及社会心理因素。", @"3、不可改变的危险因素有：性别、年龄、家族史。此外，与感染有关，如巨细胞病毒、肺炎衣原体、幽门螺杆菌等。冠心病的发作常常与季节变化、情绪激动、体力活动增加、饱食、大量吸烟和饮酒等有关。", nil];
        // 健康建议数组
        
        //    self.jianKangJianYiArray = [NSMutableArray arrayWithObjects:@"生活习惯改变：戒烟限酒，低脂低盐饮食，适当体育锻炼，控制体重等；", @"药物治疗：抗血栓（抗血小板、抗凝），减轻心肌氧耗（β受体阻滞剂），缓解心绞痛（硝酸酯类），调脂稳定斑块（他汀类调脂药）；", @"血运重建治疗：包括介入治疗（血管内球囊扩张成形术和支架植入术）和外科冠状动脉旁路移植术；", nil];
        self.jianKangJianYiArray = [NSMutableArray arrayWithObjects:@"身心愉快：精神紧张、情绪波动可诱发心绞痛。应忌暴怒、惊恐、过度思虑以及过喜；避免大喜大悲：情绪激动是健康之大忌，更是冠心病发病的罪魁祸首。", @"合理饮食。过食油腻、脂肪、糖类，会促进动脉血管壁的胆固醇的沉积，加速动脉硬化，提倡少食多餐，七八成饱，粗细粮搭配，低盐、低脂、低糖、低热量饮食，并可适当多食富含植物纤维的食物(如芹菜等)，同时可食用具有降血脂、保护心脑血管的食物(如洋葱、少量的红葡萄酒等)。", @"合理饮食。过食油腻、脂肪、糖类，会促进动脉血管壁的胆固醇的沉积，加速动脉硬化，提倡少食多餐，七八成饱，粗细粮搭配，低盐、低脂、低糖、低热量饮食，并可适当多食富含植物纤维的食物(如芹菜等)，同时可食用具有降血脂、保护心脑血管的食物(如洋葱、少量的红葡萄酒等)。", @"预防脱水。脱水会导致血黏度升高，易造成缺血或心脑血管堵塞，不要等到渴了才想喝水，那时已造成程度不同的“脱水”了，建议睡前半小时、或者是半夜醒来及清晨起床后最好喝一些开水。", @"适当锻炼。有些患者认为运动会诱发冠心病发作，其实适当合理的运动，可以提高心肌利用氧的能力，减少心肌耗氧。当然应选择适宜的运动类型，如慢跑、散步等，并在运动强度和时间上加以控制，循序渐进、避免劳累。", @"劳逸结合。应避免过重体力劳动或突然用力，不要劳累过度。走路、上楼梯、骑车宜慢，否则会引起心率加快，血压增高，诱发心绞痛。饱餐后不宜运动。", @"注意防寒保暖。严寒、低气压、温差大的恶劣气候，会使人体处于一种应激状态，血管收缩使血压增高，心脏的负荷加大，供应心脏血液的冠状动脉痉挛，使得原本因粥样硬化而狭窄的血管更加狭窄，甚至闭塞。",  @"戒烟少酒：吸烟是造成心肌梗塞、中风的重要因素，应绝对戒烟。少量饮啤酒、黄酒、葡萄酒等低度酒可促进血脉流通，气血调和。烈性酒在禁忌之列。不宜喝浓茶、咖啡。", @"防治三高。控制血压，理想血压是120/80mmHg；低脂饮食，防治高脂血症；维持血糖正常，积极治疗糖尿病。", @"控制体重。肥胖加重心脏的负担，因而，体重不能超标。", @"适量补充营养素，如服用蛋白质粉，维生素E，维生素C，维生素B，钙镁片等，加强的血管的弹性，降低了心肌的耗氧量。", @"药物辅助。在上述方法效果不满意时，应在医生指导下选用副作用小的扩张冠状动脉药物、β受体阻滞剂。", @"掌握急救：冠心病通常发病突然，所以一些急救药品如硝酸甘油、速效救心丸等应随身携带，家中应该常备氧气、血压计等医疗器械。", @"定期体检。若评估为高风险或出现疑似临床症状，可通过心电图、负荷彩超、多排CT、冠状动脉血管造影进行检查，目前医疗界称第四种为诊断冠心病的金标准", nil];
        
       [self addMySubview];
    } else {
        // 单项请求url
        NSString *danXiangUrl = [NSString stringWithFormat:@"%@", kZGWGetDetailDanXiangByName];
        NSDictionary *paramaterDic = @{@"name":self.zgwDiseaseOnShiLiBaoGaoModel.name};
        AFHTTPSessionManager *manager = [AFHTTPSessionManager manager];
        [manager GET:danXiangUrl parameters:paramaterDic success:^(NSURLSessionDataTask *task, id responseObject) {
            self.numberOfTime = 0;
            [self.myTimer invalidate];
            // 关闭动画
            [[JiaZaiAnimationHandle shareJiaZaiAnimationHandle] stopAnimation];
            if (!responseObject) {
                return;
            }
            self.navigationItem.title = self.zgwDiseaseOnShiLiBaoGaoModel.name;
            
            NSDictionary *statusDic = [responseObject valueForKey:@"status"];
            NSString *codeString = [NSString stringWithFormat:@"%@", [statusDic valueForKey:@"code"]];
            if ([codeString isEqualToString:@"0"]) {
                
                NSDictionary *singleDic = [responseObject valueForKey:@"single"];
                
                // 疾病介绍
                self.diseaseIntroduceString = [singleDic valueForKey:@"summary"];
                
                // 平均患病概率
                NSString *prevalence = [singleDic valueForKey:@"prevalence"];
                NSString *baiFenHao = @"%";
                if (self.zgwDiseaseOnShiLiBaoGaoModel.probility.length == 0) {
                    self.huanBingGaiLv = [NSMutableArray arrayWithObjects:[NSString stringWithFormat:@"%@%@", [NSString stringWithFormat:@"%.2f", [prevalence floatValue]], baiFenHao], @"0%", nil];
                } else {
                    if ([self.zgwDiseaseOnShiLiBaoGaoModel.probility floatValue] >= 20) {
                        self.huanBingGaiLv = [NSMutableArray arrayWithObjects:[NSString stringWithFormat:@"%@%@", [NSString stringWithFormat:@"%.2f", [prevalence floatValue]], baiFenHao], @"20.00%" , nil];
                    } else {
                        self.huanBingGaiLv = [NSMutableArray arrayWithObjects:[NSString stringWithFormat:@"%@%@", [NSString stringWithFormat:@"%.2f", [prevalence floatValue]], baiFenHao], [NSString stringWithFormat:@"%.2f%@", [self.zgwDiseaseOnShiLiBaoGaoModel.probility floatValue], baiFenHao] , nil];
                    }
                }
                
                if (self.zgwDiseaseOnShiLiBaoGaoModel.probility_modified.length == 0) {
                    self.jiuZhengZhiArray = [NSMutableArray arrayWithObjects:[NSString stringWithFormat:@"%@%@", [NSString stringWithFormat:@"%.2f", [prevalence floatValue]], baiFenHao], @"0%", nil];
                } else {
                    if ([self.zgwDiseaseOnShiLiBaoGaoModel.probility_modified floatValue] >= 20) {
                        self.jiuZhengZhiArray = [NSMutableArray arrayWithObjects:[NSString stringWithFormat:@"%@%@", [NSString stringWithFormat:@"%.2f", [prevalence floatValue]], baiFenHao], @"20.00%", nil];
                    } else {
                        self.jiuZhengZhiArray = [NSMutableArray arrayWithObjects:[NSString stringWithFormat:@"%@%@", [NSString stringWithFormat:@"%.2f", [prevalence floatValue]], baiFenHao], [NSString stringWithFormat:@"%.2f%@", [self.zgwDiseaseOnShiLiBaoGaoModel.probility_modified floatValue], baiFenHao], nil];
                    }
                    
                }
                
                //            NSLog(@"平均患病概率%@", [NSString stringWithFormat:@"%.1f", [prevalence floatValue]]);
                //            NSLog(@"纠正后的风险指数:%@", self.zgwDiseaseOnShiLiBaoGaoModel.probility_modified);
                //            NSLog(@"纠正后风险指数的长度%ld", self.zgwDiseaseOnShiLiBaoGaoModel.probility_modified.length);
                //            NSLog(@"int = %ld", [self.zgwDiseaseOnShiLiBaoGaoModel.probility_modified integerValue]);
                //            NSLog(@"纠正数组:%@", self.jiuZhengZhiArray);
                
                // 构建基因表的数据
                NSArray *geneArray = self.zgwDiseaseOnShiLiBaoGaoModel.geneArray;
                self.jiYinBiaoGeArray = [NSMutableArray array];
                for (NSDictionary *tempDic in geneArray) {
                    JiYinJianCeJieGuoModel *model = [[JiYinJianCeJieGuoModel alloc] init];
                    [model setValuesForKeysWithDictionary:tempDic];
                    [self.jiYinBiaoGeArray addObject:model];
                }
                // 保存表格详解笑脸位置
                self.xiaoLianRectArray = [NSMutableArray array];
                for (int i = 0; i < self.jiYinBiaoGeArray.count; i++) {
                    
                    CGFloat tempCount = 30  * kAdjustParamater + 38 * i * kAdjustParamater;
                    [self.xiaoLianRectArray addObject:[NSNumber numberWithFloat:tempCount]];
                }
                
                // 染色体名字数组
                self.ranSeTiNameArray = [NSMutableArray array];
                for (NSDictionary *tempDic in geneArray) {
                    // 构建染色体的url
                    NSString *ranSeTiUrl = [NSString stringWithFormat:@"http://120.26.129.84/uploads/img/chr/png/chr%@_%@.png", [tempDic valueForKey:@"chrom"], [tempDic valueForKey:@"rs_pos"]];
                    [self.ranSeTiNameArray addObject:ranSeTiUrl];
                }
                // 染色体位置
                self.ranSeTiImageWeiZhiArray = [NSMutableArray array];
                for (int i = 0; i < self.jiYinBiaoGeArray.count; i++) {
                    //  [self.ranSeTiNameArray addObject:@"ranseti-shilibaogao"];
                    CGFloat tempHeight = 25 * kAdjustParamater + 38 * i * kAdjustParamater;
                    [self.ranSeTiImageWeiZhiArray addObject:[NSNumber numberWithFloat:tempHeight]];
                }
                
                // 其他致病因素
                NSArray *other_nosogenesisArray = [singleDic valueForKey:@"other_nosogenesis"];
                self.qiTaZhiBingYinSuArray = [NSMutableArray array];
                for (NSString *tempString in other_nosogenesisArray) {
                    [self.qiTaZhiBingYinSuArray addObject:tempString];
                }
                // 健康建议
                NSArray *advanceArray = self.zgwDiseaseOnShiLiBaoGaoModel.advanceArray;
                self.jianKangJianYiArray = [NSMutableArray array];
                for (NSString *tempString in advanceArray) {
                    [self.jianKangJianYiArray addObject:tempString];
                }
                // 图片url
                self.imageUrl = [singleDic valueForKey:@"img_url"];
                
                // 局限性数组
                self.jvXianXingArray = [NSMutableArray arrayWithObjects:@"1、该检测无法覆盖所有与检测相关的结果。", @"2、基因只是影响性状的一部分因素，其他可能的因素包括环境和生活方式等。", @"3、该结果不能用于临床诊断。", @"4、该结果会随着参与人数的增多不断优化", nil];
                
                // 单项的标签
                self.danXiangBiaoQianArray = [NSMutableArray array];
                for (NSString *tempString in self.zgwDiseaseOnShiLiBaoGaoModel.advantage) {
                    [self.danXiangBiaoQianArray addObject:tempString];
                }
                for (NSString *tempString in self.zgwDiseaseOnShiLiBaoGaoModel.notice) {
                    [self.danXiangBiaoQianArray addObject:tempString];
                }

            } else {
                [[JiaZaiAnimationHandle shareJiaZaiAnimationHandle] addAlertNoTitieWithContent:@"单项数据获取失败，请返回重试" toView:self];
            }
            
            
            // 布局
            [self addMySubview];
            
        } failure:^(NSURLSessionDataTask *task, NSError *error) {
            // 关闭动画
            [[JiaZaiAnimationHandle shareJiaZaiAnimationHandle] stopAnimation];
            // 添加提示框
            [[JiaZaiAnimationHandle shareJiaZaiAnimationHandle] addAlertTitle:@"通知" Content:@"请求数据失败，请返回上一页后重新进入" ToView:self];
            // 暂停计时器
            [self.myTimer invalidate];
            self.numberOfTime = 0;
        }];
    }
    
}

// navi的修改
- (void)changeNavigation
{
  //  self.navigationItem.title = @"示例报告";
    UIImageView *leftImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 30, 30)];
    leftImageView.image = [UIImage imageNamed:@"houtui"];
    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:leftImageView];
    UITapGestureRecognizer *leftTapGes = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(lastPage:)];
    [leftImageView addGestureRecognizer:leftTapGes];
    
}

#pragma mark - 返回上一页面
- (void)lastPage:(UITapGestureRecognizer *)tapGes
{
    [self.navigationController popViewControllerAnimated:YES];
}

- (void)addMySubview
{
    // 背景
    self.backGroundScrollview = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, kScreenHeight)];
    self.backGroundScrollview.backgroundColor = [UIColor whiteColor];
    self.backGroundScrollview.contentSize = CGSizeMake(kScreenWidth, 3 * kScreenHeight);
    self.backGroundScrollview.bounces = NO;
    self.backGroundScrollview.showsVerticalScrollIndicator = NO;
    [self.view addSubview:_backGroundScrollview];
    
    // 疾病介绍标题label
    UILabel *diseaseIntroduceTitleLabel = [[UILabel alloc] initWithFrame:CGRectMake(0 * kAdjustParamater, 15 * kAdjustParamater, 375 * kAdjustParamater, 20 * kAdjustParamater)];
    // diseaseIntroduceTitleLabel.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.1];
    if (self.isShiLiBaoGao == YES) {
        diseaseIntroduceTitleLabel.text = @"冠心病介绍";
    } else {
        diseaseIntroduceTitleLabel.text = [NSString stringWithFormat:@"%@介绍", self.zgwDiseaseOnShiLiBaoGaoModel.name];
    }
    
    diseaseIntroduceTitleLabel.textColor = kCyanColor;
    diseaseIntroduceTitleLabel.textAlignment = NSTextAlignmentCenter;
    diseaseIntroduceTitleLabel.font = [UIFont fontWithName:@"Arial-BoldMT" size:k20Big];
    [self.backGroundScrollview addSubview:diseaseIntroduceTitleLabel];
    
    // 计算疾病名字的长度
    CGFloat widthOfDieaseName = [[NetStatusHandle shareHandle] adjustWidth:diseaseIntroduceTitleLabel.text size:20 height:20];

    // 进入圈子
    UIImageView *joinQuanZiImageV = [[UIImageView alloc] initWithFrame:CGRectMake(290 * kAdjustParamater, 17 * kAdjustParamater, 15 * kAdjustParamater, 15 * kAdjustParamater)];
    joinQuanZiImageV.image = [UIImage imageNamed:@"三角图片"];
    [self.backGroundScrollview addSubview:joinQuanZiImageV];
    
  
    
    UIButton *joinQuanZiButton = [UIButton buttonWithType:UIButtonTypeSystem];
    joinQuanZiButton.frame = CGRectMake(joinQuanZiImageV.right, 17 * kAdjustParamater, 70 * kAdjustParamater, 15 * kAdjustParamater);
    [joinQuanZiButton setTitle:@"进入圈子" forState:UIControlStateNormal];
    [joinQuanZiButton setTitleColor:[[UIColor blackColor] colorWithAlphaComponent:0.5] forState:UIControlStateNormal];
    joinQuanZiButton.titleLabel.font = [UIFont fontWithName:@"Arial-BoldMT" size:k15Big];
    [joinQuanZiButton addTarget:self action:@selector(joinQuanZi:) forControlEvents:UIControlEventTouchUpInside];
    [self.backGroundScrollview addSubview:joinQuanZiButton];
    
    // 疾病介绍下方灰色条
    UILabel *grayLineOnDiseaseIntroduceBottom = [[UILabel alloc] initWithFrame:CGRectMake(0, diseaseIntroduceTitleLabel.bottom + 15 * kAdjustParamater, kScreenWidth, 1 * kAdjustParamater)];
    grayLineOnDiseaseIntroduceBottom.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.07];
    [self.backGroundScrollview addSubview:grayLineOnDiseaseIntroduceBottom];
    
    // 疾病介绍下方灰色条上方的倩色条
    UILabel *cyanLineOnDiseaseIntroduceBottom = [[UILabel alloc] initWithFrame:CGRectMake((375 * kAdjustParamater - widthOfDieaseName - 20 * kAdjustParamater) / 2, diseaseIntroduceTitleLabel.bottom + 15 * kAdjustParamater, widthOfDieaseName + 20 * kAdjustParamater, 1 * kAdjustParamater)];
    cyanLineOnDiseaseIntroduceBottom.backgroundColor = kCyanColor;
    [self.backGroundScrollview addSubview:cyanLineOnDiseaseIntroduceBottom];
#warning 疾病介绍
    // 疾病的图片
    UIImageView *jiBingImageV = [[UIImageView alloc] initWithFrame:CGRectMake(50 * kAdjustParamater, grayLineOnDiseaseIntroduceBottom.bottom + 23 * kAdjustParamater, 275 * kAdjustParamater, 178 * kAdjustParamater)];
    jiBingImageV.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.1];
    [jiBingImageV sd_setImageWithURL:[NSURL URLWithString:self.imageUrl] placeholderImage:[UIImage imageNamed:@""]];
    jiBingImageV.layer.cornerRadius = 5 * kAdjustParamater;
    jiBingImageV.layer.masksToBounds = YES;
    [self.backGroundScrollview addSubview:jiBingImageV];
    
    // 疾病介绍
    UILabel *diseaseIntroduceLabel = [[UILabel alloc] initWithFrame:CGRectMake(11 * kAdjustParamater, jiBingImageV.bottom + 20 * kAdjustParamater, (375 - 22) * kAdjustParamater, 50 * kAdjustParamater)];
    //  diseaseIntroduceLabel.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.1];
  
    diseaseIntroduceLabel.text = self.diseaseIntroduceString;
    diseaseIntroduceLabel.textColor = [UIColor blackColor];
    diseaseIntroduceLabel.font = [UIFont systemFontOfSize:k15Big];
    diseaseIntroduceLabel.numberOfLines = 0;
    // 调整行间距
    [diseaseIntroduceLabel setAttributedText:[[NetStatusHandle shareHandle] setHangJianJvOfLabel:diseaseIntroduceLabel.text lineHeight:5]];
    [diseaseIntroduceLabel sizeToFit];
    [self.backGroundScrollview addSubview:diseaseIntroduceLabel];
    
    
    // 疾病介绍下方的灰色条
    UILabel *grayLineOnJiBingJieShaoBottom = [[UILabel alloc] initWithFrame:CGRectMake(0, diseaseIntroduceLabel.bottom + 30 * kAdjustParamater, kScreenWidth, 10 * kAdjustParamater)];
    grayLineOnJiBingJieShaoBottom.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.05];
    [self.backGroundScrollview addSubview:grayLineOnJiBingJieShaoBottom];
    
#warning   检测结果
    // 检测结果

    UILabel *whoJianCeJieGuoLabel = [[UILabel alloc] initWithFrame:CGRectMake(0 * kAdjustParamater, grayLineOnJiBingJieShaoBottom.bottom + 15 * kAdjustParamater, 375 * kAdjustParamater, 20 * kAdjustParamater)];
    // diseaseIntroduceTitleLabel.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.1];
    whoJianCeJieGuoLabel.text = [NSString stringWithFormat:@"%@的检测结果", self.userName];
    whoJianCeJieGuoLabel.textColor = kCyanColor;
    whoJianCeJieGuoLabel.textAlignment = NSTextAlignmentCenter;
    whoJianCeJieGuoLabel.font = [UIFont fontWithName:@"Arial-BoldMT" size:k20Big];
    [self.backGroundScrollview addSubview:whoJianCeJieGuoLabel];
    
    // 计算检测结果的宽度
    CGFloat widthOfWhoJianCeJieGuoLabel = [[NetStatusHandle shareHandle] adjustWidth:whoJianCeJieGuoLabel.text size:20 height:20];
    
    // 检测结果下方灰色条
    UILabel *grayLineOnWhoJianCeJieGuoBottom = [[UILabel alloc] initWithFrame:CGRectMake(0, whoJianCeJieGuoLabel.bottom + 15 * kAdjustParamater, kScreenWidth, 1 * kAdjustParamater)];
    grayLineOnWhoJianCeJieGuoBottom.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.07];
    [self.backGroundScrollview addSubview:grayLineOnWhoJianCeJieGuoBottom];
    
    // 基因位点检测信息下方灰色条上方的倩色条
    UILabel *cyanLineOnWhoJianCeJieGuoBottom = [[UILabel alloc] initWithFrame:CGRectMake((375 * kAdjustParamater - widthOfWhoJianCeJieGuoLabel - 20 * kAdjustParamater) / 2, whoJianCeJieGuoLabel.bottom + 15 * kAdjustParamater, widthOfWhoJianCeJieGuoLabel + 20 * kAdjustParamater, 1 * kAdjustParamater)];
    cyanLineOnWhoJianCeJieGuoBottom.backgroundColor = kCyanColor;
    [self.backGroundScrollview addSubview:cyanLineOnWhoJianCeJieGuoBottom];
    
    // 柱子
    self.myZhuZhuangView = [[MCBarChartView alloc] initWithFrame:CGRectMake(-10 * kAdjustParamater, grayLineOnWhoJianCeJieGuoBottom.bottom + 10 * kAdjustParamater, 210 * kAdjustParamater, 180 * kAdjustParamater)];
    // self.myZhuZhuangView.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.1];
    self.myZhuZhuangView.dataSource  = self;
    self.myZhuZhuangView.delegate = self;
    self.myZhuZhuangView.tag = 400;
    self.myZhuZhuangView.maxValue = @"20";
    [self.backGroundScrollview addSubview:_myZhuZhuangView];
    
    // 饼状图
    //   self.myBingZhuangView = [[XYPieChart alloc] initWithFrame:CGRectMake(self.myZhuZhuangView.right + 10 * kAdjustParamater, self.myZhuZhuangView.top, 100 * kAdjustParamater, 100 * kAdjustParamater) Center:CGPointMake(self.myZhuZhuangView.right + 70 * kAdjustParamater, self.myZhuZhuangView.top + 70 * kAdjustParamater) Radius:50];
    self.myBingZhuangView = [[XYPieChart alloc] init];
    self.myBingZhuangView.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.1];
    self.myBingZhuangView.startPieAngle = M_PI_4 * 6;
    self.myBingZhuangView.animationSpeed = 0.1;
    self.myBingZhuangView.pieRadius = 40 * kAdjustParamater;
    self.myBingZhuangView.labelRadius = 53 * kAdjustParamater;
    self.myBingZhuangView.showLabel = YES;
    self.myBingZhuangView.showPercentage = NO;
    self.myBingZhuangView.pieCenter = CGPointMake(self.myZhuZhuangView.right + 60 * kAdjustParamater, self.myZhuZhuangView.top + 100 * kAdjustParamater);
    self.myBingZhuangView.labelFont = [UIFont systemFontOfSize:k15Big];
    
    
    //    self.myBingZhuangView.pieCenter = CGPointMake(self.myZhuZhuangView.right + 70 * kAdjustParamater, self.myZhuZhuangView.top + 70 * kAdjustParamater);
    //    self.myBingZhuangView.showPercentage = NO;
    //    [self.myBingZhuangView setPieBackgroundColor:[UIColor whiteColor]];
    
    //    self.myBingZhuangView.pieCenter = CGPointMake(self.myZhuZhuangView.right + 70 * kAdjustParamater, self.myZhuZhuangView.top + 70 * kAdjustParamater);
    //    self.myBingZhuangView.pieRadius = 50 * kAdjustParamater;
    
    self.myBingZhuangView.dataSource = self;
    [self.myBingZhuangView reloadData];
    [self.backGroundScrollview addSubview:_myBingZhuangView];
    
    // 10W人患病概率
    UILabel *shiWanPeopleLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.myZhuZhuangView.right, self.myZhuZhuangView.top + 10 * kAdjustParamater, 150 * kAdjustParamater, 15 * kAdjustParamater)];
    //   shiWanPeopleLabel.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.1];
    shiWanPeopleLabel.text = @"10万人患病人数";
    shiWanPeopleLabel.font = [UIFont systemFontOfSize:k15Big];
    [self.backGroundScrollview addSubview:shiWanPeopleLabel];
    
    UILabel *shiWanPeopleHuanBingCountLabel = [[UILabel alloc] initWithFrame:CGRectMake(shiWanPeopleLabel.left + 10 * kAdjustParamater, shiWanPeopleLabel.bottom + 20 * kAdjustParamater, 110 * kAdjustParamater, 10 * kAdjustParamater)];
    shiWanPeopleHuanBingCountLabel.font = [UIFont systemFontOfSize:k15Big];
    shiWanPeopleHuanBingCountLabel.textAlignment = NSTextAlignmentCenter;
    shiWanPeopleHuanBingCountLabel.text = [NSString stringWithFormat:@"%.0f人患病", [self.huanBingGaiLv.firstObject floatValue] * 100000 / 100];
    [self.backGroundScrollview addSubview:shiWanPeopleHuanBingCountLabel];
    
    UILabel *shiWanPeopleZhengChangLabel = [[UILabel alloc] initWithFrame:CGRectMake(shiWanPeopleLabel.left + 20 * kAdjustParamater, shiWanPeopleLabel.bottom + 120 * kAdjustParamater, 90 * kAdjustParamater, 13 * kAdjustParamater)];
    NSString *baiFenHao = @"%";
    shiWanPeopleZhengChangLabel.text = [NSString stringWithFormat:@"%.2f%@", 100 - [self.huanBingGaiLv[0]floatValue], baiFenHao];
    shiWanPeopleZhengChangLabel.textAlignment = NSTextAlignmentCenter;
    shiWanPeopleZhengChangLabel.textColor = [UIColor blackColor];
    shiWanPeopleZhengChangLabel.font = [UIFont systemFontOfSize:k15Big];
    [self.backGroundScrollview addSubview:shiWanPeopleZhengChangLabel];
    
    // 正常图片
    UILabel *zhengChangImageV = [[UILabel alloc] initWithFrame:CGRectMake(self.myZhuZhuangView.right + 115 * kAdjustParamater, self.myZhuZhuangView.top + 95 * kAdjustParamater, 15 * kAdjustParamater, 15 * kAdjustParamater)];
    zhengChangImageV.backgroundColor = [UIColor colorWithRed:122 / 255.0 green:7 / 255.0 blue:84 / 255.0 alpha:1];
    zhengChangImageV.layer.cornerRadius = 3 * kAdjustParamater;
    zhengChangImageV.layer.masksToBounds = YES;
    [self.backGroundScrollview addSubview:zhengChangImageV];
    
    // 正常标题
    UILabel *zhengChangTitleLabel = [[UILabel alloc] initWithFrame:CGRectMake(zhengChangImageV.right + 10 * kAdjustParamater, zhengChangImageV.top, 50 * kAdjustParamater, 15 * kAdjustParamater)];
    //   zhengChangTitleLabel.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.1];
    zhengChangTitleLabel.text = @"正常";
    zhengChangTitleLabel.textColor = [UIColor blackColor];
    zhengChangTitleLabel.textAlignment = NSTextAlignmentLeft;
    zhengChangTitleLabel.font = [UIFont systemFontOfSize:k14Big];
    [self.backGroundScrollview addSubview:zhengChangTitleLabel];
    
    // 患病图片
    UILabel *huanBingImageV = [[UILabel alloc] initWithFrame:CGRectMake(zhengChangImageV.left, zhengChangImageV.bottom + 15 * kAdjustParamater, 15 * kAdjustParamater, 15 * kAdjustParamater)];
    huanBingImageV.backgroundColor = [UIColor colorWithRed:111 / 255.0 green:113 / 255.0 blue:179 / 255.0 alpha:1];
    huanBingImageV.layer.cornerRadius = 3 * kAdjustParamater;
    huanBingImageV.layer.masksToBounds = YES;
    [self.backGroundScrollview addSubview:huanBingImageV];
    
    // 患病标题
    UILabel *huanBingTitleLabel = [[UILabel alloc] initWithFrame:CGRectMake(huanBingImageV.right + 10 * kAdjustParamater, huanBingImageV.top, 50 * kAdjustParamater, 15 * kAdjustParamater)];
    //   huanBingTitleLabel.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.1];
    huanBingTitleLabel.text = @"患病";
    huanBingTitleLabel.textColor = [UIColor blackColor];
    huanBingTitleLabel.textAlignment = NSTextAlignmentLeft;
    huanBingTitleLabel.font = [UIFont systemFontOfSize:k14Big];
    [self.backGroundScrollview addSubview:huanBingTitleLabel];
    
   
    
    // 患病几率
    NSString *fengXianLevel = self.zgwDiseaseOnShiLiBaoGaoModel.risk_level;
    NSString *fengXianLabelString = @"";
    if ([fengXianLevel isEqualToString:@"0"]) {
        // 低风险
        fengXianLabelString = @"低";
    } else if ([fengXianLevel isEqualToString:@"1"]) {
        // 较低风险
        fengXianLabelString = @"较低";
    } else if ([fengXianLevel isEqualToString:@"2"]) {
        // 正常风险
        fengXianLabelString = @"正常";
    } else if ([fengXianLevel isEqualToString:@"3"]) {
        // 较高风险
        fengXianLabelString = @"较高";
    } else if ([fengXianLevel isEqualToString:@"4"]) {
        // 高风险
        fengXianLabelString = @"高";
    }
    UILabel *huanBingJiLvLevelLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, self.myZhuZhuangView.bottom + 20 * kAdjustParamater, kScreenWidth, 15 * kAdjustParamater)];
    huanBingJiLvLevelLabel.text = [NSString stringWithFormat:@"您的%@患病几率%@", self.zgwDiseaseOnShiLiBaoGaoModel.name, fengXianLabelString];
    huanBingJiLvLevelLabel.textAlignment = NSTextAlignmentCenter;
    huanBingJiLvLevelLabel.textColor = [UIColor colorWithRed:243 / 255.0 green:151 / 255.0 blue:0 alpha:1];
    huanBingJiLvLevelLabel.font = [UIFont fontWithName:@"Arial-BoldMT" size:k15Big];
    [self.backGroundScrollview addSubview:huanBingJiLvLevelLabel];
    
    // 进行单项标签的布局
    // 记录左边开始位置
    CGFloat leftPoint = 0.0;
    // 记录其实的高度
    CGFloat heightPoint = 0.0;
    // 记录换了几次行
    NSInteger huanHangCount = 0;
    for (int i = 0; i < self.danXiangBiaoQianArray.count; i++) {
        CGFloat tempWidth = [[NetStatusHandle shareHandle] adjustWidth:self.danXiangBiaoQianArray[i] size:16 height:30];
        if ((leftPoint + tempWidth) > 329 * kAdjustParamater) {
            // 说明需要换行,这时需要重置左起位置
            leftPoint = 0.0;
            huanHangCount++;
            //  NSLog(@"huanHangCount = %ld", huanHangCount);
            heightPoint = (25 + 10) * kAdjustParamater * huanHangCount;
        }
        //  NSLog(@"heightPoint = %f", heightPoint);
        UILabel *tempLabel = [[UILabel alloc] initWithFrame:CGRectMake(23 * kAdjustParamater + leftPoint, huanBingJiLvLevelLabel.bottom + 20 * kAdjustParamater + heightPoint, 50 * kAdjustParamater, 25 * kAdjustParamater)];
        tempLabel.text = self.danXiangBiaoQianArray[i];
        tempLabel.backgroundColor = [UIColor whiteColor];
        tempLabel.textColor = [UIColor colorWithRed:82 / 255.0 green:199 / 255.0 blue:220 / 255.0 alpha:1];
        tempLabel.tag = 200 + i;
        tempLabel.textAlignment = NSTextAlignmentCenter;
        tempLabel.font = [UIFont fontWithName:@"Arial-BoldMT" size:k15Big];
        tempLabel.layer.cornerRadius = 10 * kAdjustParamater;
        tempLabel.layer.masksToBounds = YES;
        tempLabel.layer.borderColor = [[UIColor colorWithRed:72 / 255.0 green:170 / 255.0 blue:204 / 255.0 alpha:1] CGColor];
        tempLabel.layer.borderWidth = 1 * kAdjustParamater;
        
        
        // 进行自适应宽度
        CGRect newFrame = tempLabel.frame;
        newFrame.size.width = [[NetStatusHandle shareHandle] adjustWidth:tempLabel.text size:15 height:25] + 16 * kAdjustParamater;
        tempLabel.frame = newFrame;
        
        // 保存下一个label的左起位置
        leftPoint = tempLabel.frame.size.width + 13 * kAdjustParamater + leftPoint;
        //    NSLog(@"左起为止:%f", leftPoint);
        [self.backGroundScrollview addSubview:tempLabel];

    }
    
    // 取出最后一个label
    UILabel *lastLabelOfBiaoQian = (UILabel *)[self.view viewWithTag:199 + self.danXiangBiaoQianArray.count];
    
    
    
    // 患病率柱子下方的灰色条
    UILabel *grayLineOnHuanBingLvZhuZiBottom = [[UILabel alloc] initWithFrame:CGRectMake(0, lastLabelOfBiaoQian.bottom + 20 * kAdjustParamater, kScreenWidth, 10 * kAdjustParamater)];
    grayLineOnHuanBingLvZhuZiBottom.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.05];
    [self.backGroundScrollview addSubview:grayLineOnHuanBingLvZhuZiBottom];
    
    
#pragma mark - 基因位点检测信息
    // 基因位点检测信息
    UILabel *jianCeJieGuoLabel = [[UILabel alloc] initWithFrame:CGRectMake(0 * kAdjustParamater, grayLineOnHuanBingLvZhuZiBottom.bottom + 15 * kAdjustParamater, 375 * kAdjustParamater, 20 * kAdjustParamater)];
    // diseaseIntroduceTitleLabel.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.1];
    jianCeJieGuoLabel.text = @"基因位点检测信息";
    jianCeJieGuoLabel.textColor = kCyanColor;
    jianCeJieGuoLabel.textAlignment = NSTextAlignmentCenter;
    jianCeJieGuoLabel.font = [UIFont fontWithName:@"Arial-BoldMT" size:k20Big];
    [self.backGroundScrollview addSubview:jianCeJieGuoLabel];
    
    // 基因位点检测信息下方灰色条
    UILabel *grayLineOnJianCeJieGuoBottom = [[UILabel alloc] initWithFrame:CGRectMake(0, jianCeJieGuoLabel.bottom + 15 * kAdjustParamater, kScreenWidth, 1 * kAdjustParamater)];
    grayLineOnJianCeJieGuoBottom.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.07];
    [self.backGroundScrollview addSubview:grayLineOnJianCeJieGuoBottom];
    
    // 基因位点检测信息下方灰色条上方的倩色条
    UILabel *cyanLineOnJianCeJieGuoBottom = [[UILabel alloc] initWithFrame:CGRectMake((375 - 170) / 2 * kAdjustParamater, jianCeJieGuoLabel.bottom + 15 * kAdjustParamater, 170 * kAdjustParamater, 1 * kAdjustParamater)];
    cyanLineOnJianCeJieGuoBottom.backgroundColor = kCyanColor;
    [self.backGroundScrollview addSubview:cyanLineOnJianCeJieGuoBottom];
    
#warning 基因表
    self.jiYinBiaoGe = [[KWFormView alloc] initWithFrame:CGRectMake(7  *kAdjustParamater,  grayLineOnJianCeJieGuoBottom.bottom + 20 * kAdjustParamater, 360 * kAdjustParamater, (22 + 38 * self.jiYinBiaoGeArray.count) * kAdjustParamater)];
    self.jiYinBiaoGe.dataSource = self;
    self.jiYinBiaoGe.delegate = self;
    self.jiYinBiaoGe.tag = 300;
    [self.backGroundScrollview addSubview:_jiYinBiaoGe];
    
    
    for (int i = 0; i < self.jiYinBiaoGeArray.count; i++) {
        JiYinJianCeJieGuoModel *tempModel = self.jiYinBiaoGeArray[i];
        NSString *influenceString = tempModel.influence;
        // 位置
        CGFloat heightWeiZhi = [self.xiaoLianRectArray[i] floatValue];
        UIImageView *tempImageV = [[UIImageView alloc] initWithFrame:CGRectMake(230 * kAdjustParamater, heightWeiZhi * kAdjustParamater, 25 * kAdjustParamater, 25 * kAdjustParamater)];
        //   tempImageV.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.1];
        // 0代表抑制、1代表稍微抑制、2代表正常、3代表稍微促进、4代表促进
        if ([influenceString isEqualToString:@"0"]) {
            tempImageV.image = [UIImage imageNamed:@"yukuai-shillibaogao"];
        } else if ([influenceString isEqualToString:@"1"]) {
            tempImageV.image = [UIImage imageNamed:@"shaoweiyukuai-shilibaogao"];
        } else if ([influenceString isEqualToString:@"2"]) {
            tempImageV.image = [UIImage imageNamed:@"zhengchang-shilibaogao"];
        } else if ([influenceString isEqualToString:@"3"]) {
            tempImageV.image = [UIImage imageNamed:@"shaoweibugaoxing-shilibaogao"];
        } else if ([influenceString isEqualToString:@"4"]) {
            tempImageV.image = [UIImage imageNamed:@"bugaoxing-shilibaogao"];
        }
        [_jiYinBiaoGe addSubview:tempImageV];
    }
    
    // 表格详解
    UIButton *biaoGeXiangJieButton = [UIButton buttonWithType:UIButtonTypeSystem];
    biaoGeXiangJieButton.frame = CGRectMake(95 / 2 * kAdjustParamater,self.jiYinBiaoGe.bottom + 30 * kAdjustParamater, 115 * kAdjustParamater, 30 * kAdjustParamater);
    biaoGeXiangJieButton.backgroundColor = kCyanColor;
    [biaoGeXiangJieButton setTitle:@"表格详解" forState:UIControlStateNormal];
    [biaoGeXiangJieButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    biaoGeXiangJieButton.layer.cornerRadius = 5 * kAdjustParamater;
    biaoGeXiangJieButton.titleLabel.font = [UIFont fontWithName:@"Arial-BoldMT" size:k18Big];
    [biaoGeXiangJieButton addTarget:self action:@selector(biaoGeXiangJie:) forControlEvents:UIControlEventTouchUpInside];
    [self.backGroundScrollview addSubview:biaoGeXiangJieButton];
    
    // 参考文献
    UIButton *canKaoWenXianButton = [UIButton buttonWithType:UIButtonTypeSystem];
    canKaoWenXianButton.frame = CGRectMake(biaoGeXiangJieButton.right + 50 * kAdjustParamater, biaoGeXiangJieButton.top, 115 * kAdjustParamater, 30 * kAdjustParamater);
    canKaoWenXianButton.backgroundColor = kCyanColor;
    [canKaoWenXianButton setTitle:@"参考文献" forState:UIControlStateNormal];
    [canKaoWenXianButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    canKaoWenXianButton.layer.cornerRadius = 5 * kAdjustParamater;
    canKaoWenXianButton.titleLabel.font = [UIFont fontWithName:@"Arial-BoldMT" size:k18Big];
    [canKaoWenXianButton addTarget:self action:@selector(canKaoWenXian:) forControlEvents:UIControlEventTouchUpInside];
    [self.backGroundScrollview addSubview:canKaoWenXianButton];
    
    // 表格详解下方的灰色条
    UILabel *grayLineOnBiaoGeXiangJieBottom = [[UILabel alloc] initWithFrame:CGRectMake(0, biaoGeXiangJieButton.bottom + 20 * kAdjustParamater, kScreenWidth, 10 * kAdjustParamater)];
    grayLineOnBiaoGeXiangJieBottom.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.05];
    [self.backGroundScrollview addSubview:grayLineOnBiaoGeXiangJieBottom];
    
    // 基因位置标题label
    UILabel *jiYinWeiZhiLabel = [[UILabel alloc] initWithFrame:CGRectMake(0 * kAdjustParamater,grayLineOnBiaoGeXiangJieBottom.bottom + 15 * kAdjustParamater, 375 * kAdjustParamater, 20 * kAdjustParamater)];
    // diseaseIntroduceTitleLabel.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.1];
    jiYinWeiZhiLabel.text = @"基因位置";
    jiYinWeiZhiLabel.textColor = kCyanColor;
    jiYinWeiZhiLabel.textAlignment = NSTextAlignmentCenter;
    jiYinWeiZhiLabel.font = [UIFont fontWithName:@"Arial-BoldMT" size:k20Big];
    [self.backGroundScrollview addSubview:jiYinWeiZhiLabel];
    
    // 基因位置下方灰色条
    UILabel *grayLineOnJiYinWeiZhiBottom = [[UILabel alloc] initWithFrame:CGRectMake(0, jiYinWeiZhiLabel.bottom + 15 * kAdjustParamater, kScreenWidth, 1 * kAdjustParamater)];
    grayLineOnJiYinWeiZhiBottom.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.07];
    [self.backGroundScrollview addSubview:grayLineOnJiYinWeiZhiBottom];
    
    // 基因位置下方灰色条上方的倩色条
    UILabel *cyanLineOnJiYinWeiZhiBottom = [[UILabel alloc] initWithFrame:CGRectMake(275 / 2 * kAdjustParamater, jiYinWeiZhiLabel.bottom + 15 * kAdjustParamater, 100 * kAdjustParamater, 1 * kAdjustParamater)];
    cyanLineOnJiYinWeiZhiBottom.backgroundColor = kCyanColor;
    [self.backGroundScrollview addSubview:cyanLineOnJiYinWeiZhiBottom];
    
#warning 染色体信息
    // 染色体信息背景
    UIView *ranSeTiBackGroundView = [[UIView alloc] initWithFrame:CGRectMake(10 * kAdjustParamater, grayLineOnJiYinWeiZhiBottom.bottom + 20 * kAdjustParamater, 355 * kAdjustParamater, 170 * kAdjustParamater)];
    ranSeTiBackGroundView.backgroundColor = kCyanColor;
    [self.backGroundScrollview addSubview:ranSeTiBackGroundView];
    
    // 染色体信息标题
    UILabel *ranSeTiTitleLabel = [[UILabel alloc] initWithFrame:CGRectMake(255 / 2 * kAdjustParamater, 5 * kAdjustParamater, 100 * kAdjustParamater, 17 * kAdjustParamater)];
    //   ranSeTiTitleLabel.backgroundColor = [[UIColor redColor] colorWithAlphaComponent:0.1];
    ranSeTiTitleLabel.text = @"染色体信息";
    ranSeTiTitleLabel.textColor = [UIColor whiteColor];
    ranSeTiTitleLabel.textAlignment = NSTextAlignmentCenter;
    ranSeTiTitleLabel.font = [UIFont fontWithName:@"Arial-BoldMT" size:k17Big];
    [ranSeTiBackGroundView addSubview:ranSeTiTitleLabel];
    
    // 染色体表格
    self.ranSeTiBiaoGe = [[KWFormView alloc] initWithFrame:CGRectMake(10 * kAdjustParamater, 27 * kAdjustParamater, 335 * kAdjustParamater, (22 + 38 * self.jiYinBiaoGeArray.count) * kAdjustParamater)];
    self.ranSeTiBiaoGe.dataSource = self;
    self.ranSeTiBiaoGe.delegate = self;
    self.ranSeTiBiaoGe.tag = 301;
    [ranSeTiBackGroundView addSubview:_ranSeTiBiaoGe];
    // 重新布局染色体背景的大小
    ranSeTiBackGroundView.frame = CGRectMake(ranSeTiBackGroundView.frame.origin.x, ranSeTiBackGroundView.frame.origin.y, ranSeTiBackGroundView.width, self.ranSeTiBiaoGe.height + 37 * kAdjustParamater);
    // 添加染色体图片
    for (int i = 0; i < self.ranSeTiImageWeiZhiArray.count; i++) {
        CGFloat ranSeTiHeight= [self.ranSeTiImageWeiZhiArray[i] floatValue];
        UIImageView *ranSeTiImageV = [[UIImageView alloc] initWithFrame:CGRectMake(145 * kAdjustParamater, ranSeTiHeight, 180 * kAdjustParamater, 33 * kAdjustParamater)];
        if (self.ranSeTiNameArray.count > i) {
            [ranSeTiImageV sd_setImageWithURL:[NSURL URLWithString:self.ranSeTiNameArray[i]] placeholderImage:[UIImage imageNamed:@""]];
        }
        [self.ranSeTiBiaoGe addSubview:ranSeTiImageV];
    }
    
    // 染色体表格下方的灰色条
    UILabel *grayLineOnRanSeTiBiaoGeBottom = [[UILabel alloc] initWithFrame:CGRectMake(0, ranSeTiBackGroundView.bottom + 20 * kAdjustParamater, kScreenWidth, 10 * kAdjustParamater)];
    grayLineOnRanSeTiBiaoGeBottom.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.05];
    [self.backGroundScrollview addSubview:grayLineOnRanSeTiBiaoGeBottom];
    
    
    
#warning 其他致病因素
    // 其他致病因素背景
    
    
    UILabel *qiTaZhiBingYinSuLabel = [[UILabel alloc] initWithFrame:CGRectMake(0 * kAdjustParamater, grayLineOnRanSeTiBiaoGeBottom.bottom + 15 * kAdjustParamater, 375 * kAdjustParamater, 20 * kAdjustParamater)];
    // diseaseIntroduceTitleLabel.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.1];
    qiTaZhiBingYinSuLabel.text = @"其他致病因素";
    qiTaZhiBingYinSuLabel.textColor = kCyanColor;
    qiTaZhiBingYinSuLabel.textAlignment = NSTextAlignmentCenter;
    qiTaZhiBingYinSuLabel.font = [UIFont fontWithName:@"Arial-BoldMT" size:k20Big];
    [self.backGroundScrollview addSubview:qiTaZhiBingYinSuLabel];
    
    // 检测结果下方灰色条
    UILabel *grayLineOnqiTaZhiBingYinSuBottom = [[UILabel alloc] initWithFrame:CGRectMake(0, qiTaZhiBingYinSuLabel.bottom + 15 * kAdjustParamater, kScreenWidth, 1 * kAdjustParamater)];
    grayLineOnqiTaZhiBingYinSuBottom.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.07];
    [self.backGroundScrollview addSubview:grayLineOnqiTaZhiBingYinSuBottom];
    
    // 检测结果下方灰色条上方的倩色条
    UILabel *cyanLineOnqiTaZhiBingYinSuBottom = [[UILabel alloc] initWithFrame:CGRectMake(245 / 2 * kAdjustParamater, qiTaZhiBingYinSuLabel.bottom + 15 * kAdjustParamater, 130 * kAdjustParamater, 1 * kAdjustParamater)];
    cyanLineOnqiTaZhiBingYinSuBottom.backgroundColor = kCyanColor;
    [self.backGroundScrollview addSubview:cyanLineOnqiTaZhiBingYinSuBottom];
    
    //    UIView *qiTaZhiBingYinBackGroundView = [[UIView alloc] initWithFrame:CGRectMake(0, ranSeTiBackGroundView.bottom + 15 * kAdjustParamater, kScreenWidth, 28 * kAdjustParamater)];
    //    qiTaZhiBingYinBackGroundView.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.05];
    //    [self.backGroundScrollview addSubview:qiTaZhiBingYinBackGroundView];
    //
    //    // 其他致病因素标题
    //    UILabel *qiTaZhiBingTitleLabel = [[UILabel alloc] initWithFrame:CGRectMake((375 - 150) / 2 * kAdjustParamater, 5 * kAdjustParamater, 150 * kAdjustParamater, 18 * kAdjustParamater)];
    //    qiTaZhiBingTitleLabel.text = @"其他致病因素";
    //    qiTaZhiBingTitleLabel.textColor = kCyanColor;
    //    qiTaZhiBingTitleLabel.textAlignment = NSTextAlignmentCenter;
    //    qiTaZhiBingTitleLabel.font = [UIFont fontWithName:@"Arial-BoldMT" size:k17Big];
    //    [qiTaZhiBingYinBackGroundView addSubview:qiTaZhiBingTitleLabel];
    
    // 保存下一次的高度
    CGFloat zhiBingYuanYinNextHeight = 0.0;
    // 动态构建致病原因
    for (int i = 0; i < self.qiTaZhiBingYinSuArray.count; i++) {
        // 前方圆圈
        UIView *yuanQuanView = [[UIView alloc] initWithFrame:CGRectMake(18 * kAdjustParamater, 15 * kAdjustParamater + zhiBingYuanYinNextHeight + grayLineOnqiTaZhiBingYinSuBottom.bottom, 15 * kAdjustParamater, 15 * kAdjustParamater)];
        yuanQuanView.backgroundColor = kCyanColor;
        yuanQuanView.layer.cornerRadius = yuanQuanView.width / 2;
        yuanQuanView.layer.masksToBounds = YES;
        [self.backGroundScrollview addSubview:yuanQuanView];
        
        // 致病因素label
        UILabel *zhiBingYinSuLabel = [[UILabel alloc] initWithFrame:CGRectMake(yuanQuanView.right + 7 * kAdjustParamater, yuanQuanView.top - 2 * kAdjustParamater, 325 * kAdjustParamater, 10 * kAdjustParamater)];
        //     zhiBingYinSuLabel.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.1];
        zhiBingYinSuLabel.text = self.qiTaZhiBingYinSuArray[i];
        zhiBingYinSuLabel.textColor = [UIColor blackColor];
        zhiBingYinSuLabel.numberOfLines = 0;
        zhiBingYinSuLabel.tag = 500 + i;
        zhiBingYinSuLabel.font = [UIFont systemFontOfSize:k15Big];
        // 调整高度
        CGRect newZhiBingYinSuFrame = zhiBingYinSuLabel.frame;
        newZhiBingYinSuFrame.size.height = [[NetStatusHandle shareHandle] adjustHeight:zhiBingYinSuLabel.text size:15 width:325];
        zhiBingYinSuLabel.frame = newZhiBingYinSuFrame;
        zhiBingYuanYinNextHeight = zhiBingYuanYinNextHeight + zhiBingYinSuLabel.height + 10 * kAdjustParamater;
        [self.backGroundScrollview addSubview:zhiBingYinSuLabel];
    }
    // 取出最后一个label
    UILabel *lastLabel = (UILabel *)[self.view viewWithTag:499 + self.qiTaZhiBingYinSuArray.count];
    // 致病因素下面的灰色条
    UILabel *grayLineOnZhiBingYinSuBottom = [[UILabel alloc] initWithFrame:CGRectMake(0, lastLabel.bottom + 20 * kAdjustParamater, kScreenWidth, 10 * kAdjustParamater)];
    grayLineOnZhiBingYinSuBottom.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.05];
    [self.backGroundScrollview addSubview:grayLineOnZhiBingYinSuBottom];
    
    // 检测结果
    UILabel *huanBingFengXianZhiJiuZhengLabel = [[UILabel alloc] initWithFrame:CGRectMake(0 * kAdjustParamater, grayLineOnZhiBingYinSuBottom.bottom + 15 * kAdjustParamater, 375 * kAdjustParamater, 20 * kAdjustParamater)];
    // diseaseIntroduceTitleLabel.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.1];
    huanBingFengXianZhiJiuZhengLabel.text = @"患病风险纠正";
    huanBingFengXianZhiJiuZhengLabel.textColor = kCyanColor;
    huanBingFengXianZhiJiuZhengLabel.textAlignment = NSTextAlignmentCenter;
    huanBingFengXianZhiJiuZhengLabel.font = [UIFont fontWithName:@"Arial-BoldMT" size:k20Big];
    [self.backGroundScrollview addSubview:huanBingFengXianZhiJiuZhengLabel];
    
    // 检测结果下方灰色条
    UILabel *grayLineOnhuanBingFengXianZhiJiuZhengBottom = [[UILabel alloc] initWithFrame:CGRectMake(0, huanBingFengXianZhiJiuZhengLabel.bottom + 15 * kAdjustParamater, kScreenWidth, 1 * kAdjustParamater)];
    grayLineOnhuanBingFengXianZhiJiuZhengBottom.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.07];
    [self.backGroundScrollview addSubview:grayLineOnhuanBingFengXianZhiJiuZhengBottom];
    
    // 检测结果下方灰色条上方的倩色条
    UILabel *cyanLineOnhuanBingFengXianZhiJiuZhengBottom = [[UILabel alloc] initWithFrame:CGRectMake(245 / 2 * kAdjustParamater, huanBingFengXianZhiJiuZhengLabel.bottom + 15 * kAdjustParamater, 130 * kAdjustParamater, 1 * kAdjustParamater)];
    cyanLineOnhuanBingFengXianZhiJiuZhengBottom.backgroundColor = kCyanColor;
    [self.backGroundScrollview addSubview:cyanLineOnhuanBingFengXianZhiJiuZhengBottom];
    
    // 纠正风险值的介绍
    UILabel *jiZhengFengXianZhiJieShaoLabel = [[UILabel alloc] initWithFrame:CGRectMake(10 * kAdjustParamater, grayLineOnhuanBingFengXianZhiJiuZhengBottom.bottom + 20 * kAdjustParamater, 355 * kAdjustParamater, 50 * kAdjustParamater)];
    //    jiZhengFengXianZhiJieShaoLabel.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.1];
    jiZhengFengXianZhiJieShaoLabel.text = @"     根据您下单时填写的个人信息，综合考虑后得出如下所示的信息。您可以点击右边“纠正风险值”按钮改变纠正后风险值。 ";
    jiZhengFengXianZhiJieShaoLabel.textColor = kCyanColor;
    jiZhengFengXianZhiJieShaoLabel.font = [UIFont fontWithName:@"Arial-BoldMT" size:k14Big];
    jiZhengFengXianZhiJieShaoLabel.numberOfLines = 0;
    [jiZhengFengXianZhiJieShaoLabel setAttributedText:[[NetStatusHandle shareHandle] setHangJianJvOfLabel:jiZhengFengXianZhiJieShaoLabel.text lineHeight:4]];
    [jiZhengFengXianZhiJieShaoLabel sizeToFit];
    [self.backGroundScrollview addSubview:jiZhengFengXianZhiJieShaoLabel];
    
    self.jiuZhengFengXianJieShaoBottom = jiZhengFengXianZhiJieShaoLabel.bottom;
    
    //    // 纠正风险值柱状图
    //    self.jiuZhengFengXianZhiView = [[MCBarChartView alloc] initWithFrame:CGRectMake(-10 * kAdjustParamater, jiZhengFengXianZhiJieShaoLabel.bottom + 5 * kAdjustParamater, 250 * kAdjustParamater, 200 * kAdjustParamater)];
    //  //  self.jiuZhengFengXianZhiView.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.1];
    //    self.jiuZhengFengXianZhiView.dataSource = self;
    //    self.jiuZhengFengXianZhiView.delegate = self;
    //    self.jiuZhengFengXianZhiView.tag = 401;
    //    self.jiuZhengFengXianZhiView.maxValue = @"20";
    //    [self.backGroundScrollview addSubview:_jiuZhengFengXianZhiView];
    // 添加纠正风险值柱状图
   [self addJiuZhengFengXianZhuZhuangView];
    // 纠正风险值
    UIButton *jiuZhengFengXianButton = [UIButton buttonWithType:UIButtonTypeSystem];
    jiuZhengFengXianButton.backgroundColor = [UIColor whiteColor];
    jiuZhengFengXianButton.frame = CGRectMake(240 * kAdjustParamater, jiZhengFengXianZhiJieShaoLabel.bottom + 50 * kAdjustParamater, 108 * kAdjustParamater, 30 * kAdjustParamater);
    [jiuZhengFengXianButton setTitle:@"风险值矫正" forState: UIControlStateNormal];
    [jiuZhengFengXianButton setTitleColor:kCyanColor forState:UIControlStateNormal];
    jiuZhengFengXianButton.titleLabel.font = [UIFont fontWithName:@"Arial-BoldMT" size:k17Big];
    jiuZhengFengXianButton.layer.cornerRadius = 5 * kAdjustParamater;
    jiuZhengFengXianButton.layer.borderWidth = 1 * kAdjustParamater;
    jiuZhengFengXianButton.layer.borderColor = [kCyanColor CGColor];
    [jiuZhengFengXianButton addTarget:self action:@selector(jiuZhengFengXianButton:) forControlEvents:UIControlEventTouchUpInside];
    [self.backGroundScrollview addSubview:jiuZhengFengXianButton];
    
    // 提示前方的图标
    UIImageView *warningImageV = [[UIImageView alloc] initWithFrame:CGRectMake(20 * kAdjustParamater, jiZhengFengXianZhiJieShaoLabel.bottom + 215 * kAdjustParamater, 25 * kAdjustParamater, 25 * kAdjustParamater)];
    warningImageV.image = [UIImage imageNamed:@"warning-shilibaogao"];
    [self.backGroundScrollview addSubview:warningImageV];
    
    // 提示的标题
    UILabel *warningTitleLabel = [[UILabel alloc] initWithFrame:CGRectMake(warningImageV.right + 4 * kAdjustParamater, warningImageV.top + 5 * kAdjustParamater, 320 * kAdjustParamater, 12 * kAdjustParamater)];
    // warningTitleLabel.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.1];
    //  warningTitleLabel.text = @"小提示：纠正值为将基因检测结果结合生活习惯和患病历史得出的风险评估值";
    warningTitleLabel.text = @"小提示：矫正后患病概率为将基因检测结果结合您的真实资料和个人生活习惯以及疾病史计算得来，更为真实可信。";
    warningTitleLabel.textColor = [UIColor redColor];
    warningTitleLabel.font = [UIFont systemFontOfSize:k12Big];
    warningTitleLabel.numberOfLines = 0;
    CGRect newFrameOfWarningTitleLabel = warningTitleLabel.frame;
    newFrameOfWarningTitleLabel.size.height = [[NetStatusHandle shareHandle] adjustHeight:warningTitleLabel.text size:12 width:320];
    warningTitleLabel.frame = newFrameOfWarningTitleLabel;
    [self.backGroundScrollview addSubview:warningTitleLabel];
    
    // 小提示下方的灰色条
    UILabel *grayLineOnXiaoTiShiBottom = [[UILabel alloc] initWithFrame:CGRectMake(0, warningTitleLabel.bottom + 20 * kAdjustParamater, kScreenWidth, 10 * kAdjustParamater)];
    grayLineOnXiaoTiShiBottom.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.05];
    [self.backGroundScrollview addSubview:grayLineOnXiaoTiShiBottom];
    
#warning 健康建议
    // 健康建议
    UILabel *jianKangJianYiLabel = [[UILabel alloc] initWithFrame:CGRectMake(0 * kAdjustParamater, grayLineOnXiaoTiShiBottom.bottom + 15 * kAdjustParamater, 375 * kAdjustParamater, 20 * kAdjustParamater)];
    // diseaseIntroduceTitleLabel.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.1];
    jianKangJianYiLabel.text = @"健康建议";
    jianKangJianYiLabel.textColor = kCyanColor;
    jianKangJianYiLabel.textAlignment = NSTextAlignmentCenter;
    jianKangJianYiLabel.font = [UIFont fontWithName:@"Arial-BoldMT" size:k20Big];
    [self.backGroundScrollview addSubview:jianKangJianYiLabel];
    
    // 健康建议下方灰色条
    UILabel *grayLineOnjianKangJianYiBottom = [[UILabel alloc] initWithFrame:CGRectMake(0, jianKangJianYiLabel.bottom + 15 * kAdjustParamater, kScreenWidth, 1 * kAdjustParamater)];
    grayLineOnjianKangJianYiBottom.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.07];
    [self.backGroundScrollview addSubview:grayLineOnjianKangJianYiBottom];
    
    // 健康建议下方灰色条上方的倩色条
    UILabel *cyanLineOnjianKangJianYiBottom = [[UILabel alloc] initWithFrame:CGRectMake(275 / 2 * kAdjustParamater, jianKangJianYiLabel.bottom + 15 * kAdjustParamater, 100 * kAdjustParamater, 1 * kAdjustParamater)];
    cyanLineOnjianKangJianYiBottom.backgroundColor = kCyanColor;
    [self.backGroundScrollview addSubview:cyanLineOnjianKangJianYiBottom];
    
    //    // 健康建议的背景
    //    UIView *jianKangJianYiBackgroundView = [[UIView alloc] initWithFrame:CGRectMake(0, warningTitleLabel.bottom + 15 * kAdjustParamater, kScreenWidth, 28 * kAdjustParamater)];
    //    jianKangJianYiBackgroundView.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.05];
    //    [self.backGroundScrollview addSubview:jianKangJianYiBackgroundView];
    //
    //    // 健康建议标题
    //    UILabel *jianKangJianTitleLabel = [[UILabel alloc] initWithFrame:CGRectMake((375 - 150) / 2 * kAdjustParamater, 5 * kAdjustParamater, 150 * kAdjustParamater, 18 * kAdjustParamater)];
    //    jianKangJianTitleLabel.text = @"健康建议";
    //    jianKangJianTitleLabel.textColor = kCyanColor;
    //    jianKangJianTitleLabel.textAlignment = NSTextAlignmentCenter;
    //    jianKangJianTitleLabel.font = [UIFont fontWithName:@"Arial-BoldMT" size:k17Big];
    //    [jianKangJianYiBackgroundView addSubview:jianKangJianTitleLabel];
    
    // 进行健康建议的动态布局
    // 保存健康建议下一个开始位置
    CGFloat jianKangJianYiNextHeight = 0.0;
    for (int i = 0; i < self.jianKangJianYiArray.count; i++) {
        // 健康建议前方图标
        UILabel *jianKangJianYiImageV = [[UILabel alloc] initWithFrame:CGRectMake(18 * kAdjustParamater, grayLineOnjianKangJianYiBottom.bottom + 13 * kAdjustParamater + jianKangJianYiNextHeight, 42 * kAdjustParamater, 20 * kAdjustParamater)];
        jianKangJianYiImageV.backgroundColor = kCyanColor;
        jianKangJianYiImageV.text = [NSString stringWithFormat:@"NO.%d", i + 1];
        jianKangJianYiImageV.textColor = [UIColor whiteColor];
        jianKangJianYiImageV.textAlignment = NSTextAlignmentCenter;
        jianKangJianYiImageV.font = [UIFont fontWithName:@"Arial-BoldMT" size:k14Big];
        jianKangJianYiImageV.layer.cornerRadius = 5 * kAdjustParamater;
        jianKangJianYiImageV.layer.masksToBounds = YES;
        [self.backGroundScrollview addSubview:jianKangJianYiImageV];
        
        // 健康建议内容
        UILabel *jianKangJianYiContentLabel = [[UILabel alloc] initWithFrame:CGRectMake(jianKangJianYiImageV.right + 15 * kAdjustParamater, jianKangJianYiImageV.top + 1 * kAdjustParamater, 285 * kAdjustParamater, 10 * kAdjustParamater)];
        //    jianKangJianYiContentLabel.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.1];
        jianKangJianYiContentLabel.text = self.jianKangJianYiArray[i];
        jianKangJianYiContentLabel.textColor = [UIColor blackColor];
        jianKangJianYiContentLabel.numberOfLines = 0;
        jianKangJianYiContentLabel.font = [UIFont systemFontOfSize:k14Big];
        // 调整高度
        CGRect jianKangJianYiNewFrame = jianKangJianYiContentLabel.frame;
        jianKangJianYiNewFrame.size.height = [[NetStatusHandle shareHandle] adjustHeight:jianKangJianYiContentLabel.text size:14 width:285];
        jianKangJianYiContentLabel.frame = jianKangJianYiNewFrame;
        [self.backGroundScrollview addSubview:jianKangJianYiContentLabel];
        
        // 添加灰色条
        UILabel *grayLineOnJianKangJianYiContentBottom = [[UILabel alloc] initWithFrame:CGRectMake(0, jianKangJianYiContentLabel.bottom + 15 * kAdjustParamater, kScreenWidth, 1 * kAdjustParamater)];
        grayLineOnJianKangJianYiContentBottom.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.08];
        grayLineOnJianKangJianYiContentBottom.tag = 600 + i;
        [self.backGroundScrollview addSubview:grayLineOnJianKangJianYiContentBottom];
        jianKangJianYiNextHeight = jianKangJianYiNextHeight + jianKangJianYiContentLabel.height + 16 * kAdjustParamater + 13 * kAdjustParamater;
        
    }
    // 取出健康建议最后一个灰色条
    UILabel *lastGrayLineOfJianKangJianYi = (UILabel *)[self.view viewWithTag:599 + self.jianKangJianYiArray.count];
    // 重新对scrollView进行大小布局
    
    UILabel *grayLineOnJianKangJianYiBottom = [[UILabel alloc] initWithFrame:CGRectMake(0, lastGrayLineOfJianKangJianYi.bottom + 10 * kAdjustParamater, kScreenWidth, 10 * kAdjustParamater)];
    grayLineOnJianKangJianYiBottom.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.05];
    [self.backGroundScrollview addSubview:grayLineOnJianKangJianYiBottom];
    
    
#warning 基因检测的局限性
    // 基因检测的局限性
    UILabel *jvXianXingLabel = [[UILabel alloc] initWithFrame:CGRectMake(0 * kAdjustParamater, grayLineOnJianKangJianYiBottom.bottom + 15 * kAdjustParamater, 375 * kAdjustParamater, 20 * kAdjustParamater)];
    // diseaseIntroduceTitleLabel.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.1];
    jvXianXingLabel.text = @"基因检测的局限性";
    jvXianXingLabel.textColor = kCyanColor;
    jvXianXingLabel.textAlignment = NSTextAlignmentCenter;
    jvXianXingLabel.font = [UIFont fontWithName:@"Arial-BoldMT" size:k20Big];
    [self.backGroundScrollview addSubview:jvXianXingLabel];
    
    // 基因检测的局限性下方灰色条
    UILabel *grayLineOnjvXianXingBottom = [[UILabel alloc] initWithFrame:CGRectMake(0, jvXianXingLabel.bottom + 15 * kAdjustParamater, kScreenWidth, 1 * kAdjustParamater)];
    grayLineOnjvXianXingBottom.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.07];
    [self.backGroundScrollview addSubview:grayLineOnjvXianXingBottom];
    
    // 基因检测的局限性下方灰色条上方的倩色条
    UILabel *cyanLineOnjvXianXingBottom = [[UILabel alloc] initWithFrame:CGRectMake((375 - 170) / 2 * kAdjustParamater, jvXianXingLabel.bottom + 15 * kAdjustParamater, 170 * kAdjustParamater, 1 * kAdjustParamater)];
    cyanLineOnjvXianXingBottom.backgroundColor = kCyanColor;
    [self.backGroundScrollview addSubview:cyanLineOnjvXianXingBottom];
    
    
    // 基因检测局限性的动态布局
    // 几率下一个局限性的开始位置
    CGFloat nextJvXianXingStringStart = 0.0;
    for (int i = 0; i < self.jvXianXingArray.count; i++) {
        // 前方的圆形
        UILabel *circleLabel = [[UILabel alloc] initWithFrame:CGRectMake(15 * kAdjustParamater, grayLineOnjvXianXingBottom.bottom + 20 * kAdjustParamater + nextJvXianXingStringStart, 15 * kAdjustParamater, 15 * kAdjustParamater)];
        circleLabel.backgroundColor = kCyanColor;
        circleLabel.layer.cornerRadius = circleLabel.width / 2;
        circleLabel.layer.masksToBounds = YES;
        [self.backGroundScrollview addSubview:circleLabel];
        
        // 局限性内容
        UILabel *jvXianXingStringLabel = [[UILabel alloc] initWithFrame:CGRectMake(circleLabel.right + 5 * kAdjustParamater, circleLabel.top, 325 * kAdjustParamater, 15 * kAdjustParamater)];
        //    jvXianXingStringLabel.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.1];
        jvXianXingStringLabel.text = self.jvXianXingArray[i];
        jvXianXingStringLabel.textColor = [[UIColor blackColor] colorWithAlphaComponent:0.7];
        jvXianXingStringLabel.font = [UIFont fontWithName:@"Arial-BoldMT" size:k14Big];
        jvXianXingStringLabel.numberOfLines = 0;
        jvXianXingStringLabel.tag = 700 + i;
        // 调整行间距
        [jvXianXingStringLabel setAttributedText:[[NetStatusHandle shareHandle] setHangJianJvOfLabel:jvXianXingStringLabel.text lineHeight:4]];
        [jvXianXingStringLabel sizeToFit];
        [self.backGroundScrollview addSubview:jvXianXingStringLabel];
        
        nextJvXianXingStringStart = nextJvXianXingStringStart + jvXianXingStringLabel.height + 15 * kAdjustParamater;
        
    }
    
    // 取出最后一个局限性string
    UILabel *lastJvXianXingStringLabel = (UILabel *)[self.view viewWithTag:699 + self.jvXianXingArray.count];
    
    // 进入圈子
    UIImageView *FAQImageV = [[UIImageView alloc] initWithFrame:CGRectMake(290 * kAdjustParamater, lastJvXianXingStringLabel.bottom + 20 * kAdjustParamater, 15 * kAdjustParamater, 15 * kAdjustParamater)];
    FAQImageV.image = [UIImage imageNamed:@"三角图片"];
    [self.backGroundScrollview addSubview:FAQImageV];
    
    
    
    UIButton *FAQButton = [UIButton buttonWithType:UIButtonTypeSystem];
    FAQButton.frame = CGRectMake(FAQImageV.right, FAQImageV.top, 70 * kAdjustParamater, 15 * kAdjustParamater);
    [FAQButton setTitle:@"常见问题" forState:UIControlStateNormal];
    [FAQButton setTitleColor:[[UIColor blackColor] colorWithAlphaComponent:0.5] forState:UIControlStateNormal];
    FAQButton.titleLabel.font = [UIFont fontWithName:@"Arial-BoldMT" size:k15Big];
    [FAQButton addTarget:self action:@selector(FAQButton:) forControlEvents:UIControlEventTouchUpInside];
    [self.backGroundScrollview addSubview:FAQButton];
    
    if (self.isShiLiBaoGao == YES) {
        self.backGroundScrollview.contentSize = CGSizeMake(kScreenWidth, lastJvXianXingStringLabel.bottom + 80 * kAdjustParamater);
    } else {
        self.backGroundScrollview.contentSize = CGSizeMake(kScreenWidth, lastJvXianXingStringLabel.bottom + 130 * kAdjustParamater);
    }
    
   
  //  NSLog(@"底部：%f, 高度:%f", lastGrayLineOfJianKangJianYi.bottom, self.backGroundScrollview.contentSize.height);
}

#pragma mark - 表格的代理
- (NSInteger)numberOfRowsInFormView:(KWFormView *)formView
{
    if (formView.tag == 300) {
        return 1 + self.jiYinBiaoGeArray.count;
    } else if (formView.tag == 301) {
        return 1 + self.jiYinBiaoGeArray.count;
    }
    return 0;
}

- (NSInteger)formViewColumnsInRow:(KWFormView *)formView
{
    if (formView.tag == 300) {
        return 7;
    } else if (formView.tag == 301) {
        return 3;
    }
    return 0;
}

- (CGFloat)formView:(KWFormView *)formView widthForColumn:(NSInteger)column
{
    if (formView.tag == 300) {
        if (column == 0) {
            return 58 * kAdjustParamater;
        } else if (column == 1) {
            return 65 * kAdjustParamater;
        } else if (column == 2) {
            return 46 * kAdjustParamater;
        } else if (column == 3) {
            return 59 * kAdjustParamater;
        } else if (column == 4) {
            return 28 * kAdjustParamater;
        } else if (column == 5) {
            return 43 * kAdjustParamater;
        } else if (column == 6) {
            return 66 * kAdjustParamater;
        }
        
    } else if (formView.tag == 301) {
        if (column == 0) {
            return 70 * kAdjustParamater;
        } else if (column == 1) {
            return 70 * kAdjustParamater;
        } else if (column == 2) {
            return 195 * kAdjustParamater;
        }
    }
    return 0;
}

- (NSString *)formView:(KWFormView *)formView textForColumn:(NSInteger)column inRow:(NSInteger)row
{
    if (formView.tag == 300) {
        if (row == 0) {
            if (column == 0) {
                return @"基因";
            } else if (column == 1) {
                return @"检测位点";
            } else if (column == 2) {
                return @"基因型";
            } else if (column == 3) {
                return @"基因型概率";
            } else if (column == 4) {
                return @"评价";
            } else if (column == 5) {
                return @"影响";
            } else if (column == 6) {
                return @"参考文献数量";
            }
        } else {
            // 获得model
            if (self.jiYinBiaoGeArray.count > (row - 1)) {
                JiYinJianCeJieGuoModel *tempModel = self.jiYinBiaoGeArray[row - 1];
                if (column == 4) {
                    
                } else if (column == 0) {
                    // 基因名字
                    return tempModel.name;
                } else if (column == 1) {
                    // 检测位点
                    return tempModel.rs_id;
                } else if (column == 2) {
                    // 基因型
                    return tempModel.gene_type;
                } else if (column == 3) {
                    // 基因型概率
                    return tempModel.gene_probility;
                } else if (column == 5) {
                    // 影响
                    NSString *influenceString = @"";
                    if ([tempModel.influence isEqualToString:@"0"]) {
                        influenceString = @"抑制";
                    } else if ([tempModel.influence isEqualToString:@"1"]) {
                        influenceString = @"轻微抑制";
                    } else if ([tempModel.influence isEqualToString:@"2"]) {
                        influenceString = @"正常";
                    } else if ([tempModel.influence isEqualToString:@"3"]) {
                        influenceString = @"轻微促进";
                    } else if ([tempModel.influence isEqualToString:@"4"]) {
                        influenceString = @"促进";
                    }
                    return influenceString;
                } else if (column == 6) {
                    // 参考文献的数量
                    return [NSString stringWithFormat:@"%@个", tempModel.literature_count];
                    
                    
                }
            }
            
        }
    } else if (formView.tag == 301) {
        if (row == 0) {
            if (column == 0) {
                return @"检测位点";
            } else if (column == 1) {
                return @"染色体位置";
            } else if (column == 2) {
                return @"染色体图";
            }
        } else {
            if (self.jiYinBiaoGeArray.count > (row - 1)) {
                // 获得model
                JiYinJianCeJieGuoModel *tempModel = self.jiYinBiaoGeArray[row - 1];
                if (column == 0) {
                    // 检测位点
                    return tempModel.rs_id;
                }
                if (column == 1) {
                    // 染色体位置
                    return tempModel.location;
                }
            }
            
        }
    }
    
    return nil;
}

// 添加点击事件
- (BOOL)formView:(KWFormView *)formView addActionForColumn:(NSInteger)column inRow:(NSInteger)row
{
    if (formView.tag == 300) {
        return YES;
    }
    return NO;
}

- (void)formView:(KWFormView *)formView didSelectColumn:(NSInteger)column inRow:(NSInteger)row
{
    if (column == 6) {
        // 从1开始的，因此要减一
        NSLog(@"点击了第%ld行", row - 1);
        if (self.isShiLiBaoGao == YES) {
            WenXianCanKaoListViewController *wenXianCanKaoListVC = [[WenXianCanKaoListViewController alloc] init];
            wenXianCanKaoListVC.isShiLiBaoGao = YES;
            if ((row - 1) == 0) {
                wenXianCanKaoListVC.wenXianArray = [NSMutableArray arrayWithObjects:@"Lu X, Wang L, Chen S, et al. Genome-wide association study in Han Chinese identifies four new susceptibility loci for coronary artery disease.[J]. Nature Genetics, 2012, 44(8):890-4.", nil];
            } else if ((row - 1) == 1) {
                wenXianCanKaoListVC.wenXianArray = [NSMutableArray arrayWithObjects:@"Hinohara K, Nakajima T, Takahashi M, et al. Replication of the association between a chromosome 9p21 polymorphism and coronary artery disease in Japanese and Korean populations[J]. Journal of Human Genetics, 2008, 53(4):357-9.", nil];
            } else if ((row - 1) == 2) {
                wenXianCanKaoListVC.wenXianArray = [NSMutableArray arrayWithObjects:@"Willer C J, Sanna S, Jackson A U, et al. Newly identified loci that influence lipid concentrations and risk of coronary artery disease.[J]. Nature Genetics, 2008, 40(2):161-9.", nil];
            } else if ((row - 1) == 3) {
                wenXianCanKaoListVC.wenXianArray = [NSMutableArray arrayWithObjects:@"Schunkert H, König I R, Kathiresan S, et al. Large-scale association analysis identifies 13 new susceptibility loci for coronary artery disease[J]. Nature Genetics, 2011, 43(4):333-338.", nil];
            } else if ((row - 1) == 4) {
                wenXianCanKaoListVC.wenXianArray = [NSMutableArray arrayWithObjects:@"Gu Y, Liu Z, Li L, et al. OLR1, PON1 and MTHFR gene polymorphisms, conventional risk factors and the severity of coronary atherosclerosis in a Chinese Han population.[J]. Cellular Physiology & Biochemistry, 2013, 31(1):143-152.", nil];
            } else if ((row - 1) == 5) {
                wenXianCanKaoListVC.wenXianArray = [NSMutableArray arrayWithObjects:@"Lu X, Wang L, Chen S, et al. Genome-wide association study in Han Chinese identifies four new susceptibility loci for coronary artery disease.[J]. Nature Genetics, 2012, 44(8):890-4.", nil];
            } else if ((row - 1) == 6) {
                wenXianCanKaoListVC.wenXianArray = [NSMutableArray arrayWithObjects:@"an Wang, et al. Genome-wide association identifies a susceptibility locus for coronary artery disease in the Chinese Han population.Nature Genetics, doi:10.1038/ng.783.", nil];
            } else if ((row - 1) == 7) {
                wenXianCanKaoListVC.wenXianArray = [NSMutableArray arrayWithObjects:@"Lu X, Wang L, Chen S, et al. Genome-wide association study in Han Chinese identifies four new susceptibility loci for coronary artery disease.[J]. Nature Genetics, 2012, 44(8):890-4.", nil];
            } else if ((row - 1) == 8) {
                wenXianCanKaoListVC.wenXianArray = [NSMutableArray arrayWithObjects:@"Lu X, Wang L, Chen S, et al. Genome-wide association study in Han Chinese identifies four new susceptibility loci for coronary artery disease.[J]. Nature Genetics, 2012, 44(8):890-4.", nil];
            } else if ((row - 1) == 9) {
                wenXianCanKaoListVC.wenXianArray = [NSMutableArray arrayWithObjects:@"Shen G Q, Li L, Rao S, et al. Four SNPs on chromosome 9p21 in a South Korean population implicate a genetic locus that confers high cross-race risk for development of coronary artery disease.[J]. Arteriosclerosis Thrombosis & Vascular Biology, 2008, 28(2):360-5.", nil];
            }
            [self.navigationController pushViewController:wenXianCanKaoListVC animated:YES];
        } else {
            // 说明不是示例报告
            WenXianCanKaoListViewController *wenXianCanKaoListVC = [[WenXianCanKaoListViewController alloc] init];
            wenXianCanKaoListVC.isShiLiBaoGao = NO;
            if (self.jiYinBiaoGeArray.count > (row-1)) {
                JiYinJianCeJieGuoModel *model = self.jiYinBiaoGeArray[row-1];
                wenXianCanKaoListVC.jiYinJianCeJieGuoModel = model;
            }
            [self.navigationController pushViewController:wenXianCanKaoListVC animated:YES];
        }
    }
}

- (CGFloat)formView:(KWFormView *)formView heightForRow:(NSInteger)row
{
    if (formView.tag == 300) {
        if (row == 0) {
            return 22 * kAdjustParamater;
        } else {
            return 38 * kAdjustParamater;
        }
    } else if (formView.tag == 301) {
        if (row == 0) {
            return 22 * kAdjustParamater;
        } else {
            return 38 * kAdjustParamater;
        }
    }
    
    return 0;
}

- (UIColor *)formView:(KWFormView *)formView colorOfColumn:(NSInteger)column inRow:(NSInteger)row
{
    if (formView.tag == 300) {
        return [UIColor whiteColor];
    } else if (formView.tag == 301) {
        return [UIColor whiteColor];
    }
    return nil;
}

- (UIColor *)formView:(KWFormView *)formView contentColorOfColumn:(NSInteger)column inRow:(NSInteger)row
{
    if (formView.tag == 300) {
        return [UIColor blackColor];
    } else if (formView.tag == 301) {
        return [UIColor blackColor];
    }
    return nil;
}

- (UIColor *)formViewBorderColor:(KWFormView *)formView
{
    if (formView.tag == 300) {
        return kCyanColor;
    } else if (formView.tag == 301) {
        return kCyanColor;
    }
    return nil;
}

- (UIFont *)formViewFontOfContent:(KWFormView *)formView
{
    if (formView.tag == 300) {
        return [UIFont systemFontOfSize:k11Big];
    } else if (formView.tag == 301) {
        return [UIFont systemFontOfSize:k12Big];
    }
    return nil;
}

#pragma mark - 柱状图代理
- (NSInteger)barChartView:(MCBarChartView *)barChartView numberOfBarsInSection:(NSInteger)section
{
    if (barChartView.tag == 400) {
        return 1;
    }
    return 1;
}

- (id)barChartView:(MCBarChartView *)barChartView valueOfBarInSection:(NSInteger)section index:(NSInteger)index
{
    if (barChartView.tag == 400) {
        if (self.huanBingGaiLv.count > section) {
             return self.huanBingGaiLv[section];
        }
    } else if (barChartView.tag == 401) {
        if (self.jiuZhengZhiArray.count > section) {
             return self.jiuZhengZhiArray[section];
        }
    }
    return nil;
}

- (NSInteger)numberOfSectionsInBarChartView:(MCBarChartView *)barChartView
{
    if (barChartView.tag == 400) {
        return 2;
    } else if (barChartView.tag == 401) {
        return 2;
    }
    return 0;
}

- (NSString *)barChartView:(MCBarChartView *)barChartView titleOfBarInSection:(NSInteger)section
{
    if (barChartView.tag == 400) {
        if (section == 0) {
            return @"中国人群患病\n概率";
        } else if (section ==1) {
            return @"您的患病\n概率";
        }
    } else if (barChartView.tag == 401) {
        if (section == 0) {
            return @"中国人群患病\n概率";
        } else if (section == 1) {
            return @"矫正后您的患病概率";
        }
    }
    
    return @"";
}

- (CGFloat)barWidthInBarChartView:(MCBarChartView *)barChartView
{
    if (barChartView.tag == 400) {
        return 35 * kAdjustParamater;
    } else if (barChartView.tag == 401) {
        return 40 * kAdjustParamater;
    }
    return 0;
}

- (CGFloat)paddingForSectionInBarChartView:(MCBarChartView *)barChartView
{
    if (barChartView.tag == 400) {
        return 30 * kAdjustParamater;
    } else if (barChartView.tag == 401) {
        return 40 * kAdjustParamater;
    }
    return 0;
}

- (UIColor *)barChartView:(MCBarChartView *)barChartView colorOfBarInSection:(NSInteger)section index:(NSInteger)index
{
    if (barChartView.tag == 400) {
        if (section == 0) {
            return [UIColor colorWithRed:78 / 255.0 green:172 / 255.0 blue:46 / 255.0 alpha:1];
        } else if (section == 1) {
            return [UIColor colorWithRed:239 / 255.0 green:159 / 255.0 blue:23 / 255.0 alpha:1];
        }
    } else if (barChartView.tag == 401) {
        if (section == 0) {
            return [UIColor colorWithRed:184 / 255.0 green:186 / 255.0 blue:21 / 255.0 alpha:1];
        } else if (section == 1) {
            return [UIColor colorWithRed:102 / 255.0 green:181 / 255.0 blue:77 / 255.0 alpha:1];
        }
    }
    return nil;
}

- (NSString *)barChartView:(MCBarChartView *)barChartView informationOfBarInSection:(NSInteger)section index:(NSInteger)index
{
    if (barChartView.tag == 400) {
//        NSString *baiFenHao = @"%";
//        return [NSString stringWithFormat:@"%@%@", self.huanBingGaiLv[section], baiFenHao];
        return self.huanBingGaiLv[section];
    } else if (barChartView.tag == 401) {
//        NSString *baiFenHao = @"%";
//        return [NSString stringWithFormat:@"%@%@", self.jiuZhengZhiArray[section], baiFenHao];
         return self.jiuZhengZhiArray[section];
    }
    return nil;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

#pragma mark - 饼状图代理
- (NSUInteger)numberOfSlicesInPieChart:(XYPieChart *)pieChart
{
    return 2;
}

- (CGFloat)pieChart:(XYPieChart *)pieChart valueForSliceAtIndex:(NSUInteger)index
{
    if (index == 0) {
      
        return 100 - [self.huanBingGaiLv[0] floatValue];
    }
    return [self.huanBingGaiLv[0] floatValue];
}

- (UIColor *)pieChart:(XYPieChart *)pieChart colorForSliceAtIndex:(NSUInteger)index
{
    if (index == 0) {
        return [UIColor colorWithRed:122 / 255.0 green:7 / 255.0 blue:84 / 255.0 alpha:1];
    }
    return [UIColor colorWithRed:111 / 255.0 green:113 / 255.0 blue:179 / 255.0 alpha:1];
}


#pragma mark  - 表格详解
- (void)biaoGeXiangJie:(UIButton *)button
{
    NSLog(@"表格详解");
    ZGWBiaoGeXiangJieViewController *zgwBiaoGeXiangJieVC = [[ZGWBiaoGeXiangJieViewController alloc] init];
    [self.navigationController pushViewController:zgwBiaoGeXiangJieVC animated:YES];
}

- (void)canKaoWenXian:(UIButton *)button
{
    NSLog(@"参考文献");
    ZGWGeneListViewController *zgwGeneListVC = [[ZGWGeneListViewController alloc] init];
    if (self.isShiLiBaoGao == YES) {
         zgwGeneListVC.geneListData = [NSMutableArray arrayWithArray:self.jiYinArray];
        zgwGeneListVC.isShiLiBaoGao = self.isShiLiBaoGao;
    } else {
         zgwGeneListVC.geneListData = [NSMutableArray arrayWithArray:self.zgwDiseaseOnShiLiBaoGaoModel.geneArray];
        zgwGeneListVC.isShiLiBaoGao = self.isShiLiBaoGao;
    }
   
    [self.navigationController pushViewController:zgwGeneListVC animated:YES];
}

#pragma mark - 纠正风险值
- (void)jiuZhengFengXianButton:(UIButton *)button
{
    NSLog(@"纠正风险值"); 
    ZGWJiBingFengXianJiuZhengViewController *zgwJiBingFengXianJiuZhengVC = [[ZGWJiBingFengXianJiuZhengViewController alloc] init];
   
    zgwJiBingFengXianJiuZhengVC.dieaseName = self.zgwDiseaseOnShiLiBaoGaoModel.name;
    zgwJiBingFengXianJiuZhengVC.riskScore = [NSString stringWithFormat:@"%.2f", [self.zgwDiseaseOnShiLiBaoGaoModel.risk_score floatValue]];
    zgwJiBingFengXianJiuZhengVC.recordID = self.zgwDiseaseOnShiLiBaoGaoModel.recordID;
    zgwJiBingFengXianJiuZhengVC.isShiLiBaoGao = NO;
    zgwJiBingFengXianJiuZhengVC.isJianKangDangAnOrShiLiBaoGao = self.isJianKangDangAn; // yes为示例报告，no为健康档案
    if (zgwJiBingFengXianJiuZhengVC.isShiLiBaoGao == NO) {
        __block DanXiangDieaseViewController *mySelf = self;
        zgwJiBingFengXianJiuZhengVC.ZgwJiBingFengXianJiuZhengZhenData = ^void(NSString *probility_modified, NSString *risk_score) {
            NSString *baiFeiHao = @"%";
            if ([probility_modified floatValue] >= 20) {
                [mySelf.jiuZhengZhiArray replaceObjectAtIndex:1 withObject:@"20.00%"];
            } else {
                [mySelf.jiuZhengZhiArray replaceObjectAtIndex:1 withObject:[NSString stringWithFormat:@"%.2f%@", [probility_modified floatValue], baiFeiHao]];
            }
           
            [mySelf addJiuZhengFengXianZhuZhuangView];
            self.zgwDiseaseOnShiLiBaoGaoModel.risk_score = [NSString stringWithFormat:@"%.2f", [risk_score floatValue]];
        };
    } else {
        __block DanXiangDieaseViewController *mySelf = self;
        zgwJiBingFengXianJiuZhengVC.ZgwJiBingFengXianJiuZheng = ^void(float jiuZhengCount) {
            // 重新布局
            //  [mySelf addMySubview];
            // 这个是本地的数据
            float jiuZhengQian = [[self.jiuZhengZhiArray firstObject] floatValue];
            NSString *jiuZhengHou = [NSString stringWithFormat:@"%.0f", jiuZhengCount * jiuZhengQian];
            [mySelf.jiuZhengZhiArray replaceObjectAtIndex:1 withObject:jiuZhengHou];
            [mySelf addJiuZhengFengXianZhuZhuangView];
        };
    }
    [self.navigationController pushViewController:zgwJiBingFengXianJiuZhengVC animated:YES];
}

#pragma mark - 进行纠正风险值柱状图的布局
- (void)addJiuZhengFengXianZhuZhuangView
{
    // 纠正风险值柱状图
    self.jiuZhengFengXianZhiView = [[MCBarChartView alloc] initWithFrame:CGRectMake(-10 * kAdjustParamater, self.jiuZhengFengXianJieShaoBottom + 5 * kAdjustParamater, 250 * kAdjustParamater, 200 * kAdjustParamater)];
    self.jiuZhengFengXianZhiView.backgroundColor = [[UIColor whiteColor] colorWithAlphaComponent:1];
    self.jiuZhengFengXianZhiView.dataSource = self;
    self.jiuZhengFengXianZhiView.delegate = self;
    self.jiuZhengFengXianZhiView.tag = 401;
    self.jiuZhengFengXianZhiView.maxValue = @"20";
    [self.backGroundScrollview addSubview:_jiuZhengFengXianZhiView];
    
}

#pragma mark - 进入圈子
- (void)joinQuanZi:(UIButton *)button
{
    NSLog(@"进入圈子");
    NSString *getQuanZiID = [NSString stringWithFormat:@"%@?token=%@", kZGWGetQuanZiIDByName, kCurrentUserToken];
    NSDictionary *paramaterDic = @{@"name":self.zgwDiseaseOnShiLiBaoGaoModel.name};
    AFHTTPSessionManager *manager = [AFHTTPSessionManager manager];
    [manager GET:getQuanZiID parameters:paramaterDic success:^(NSURLSessionDataTask *task, id responseObject) {
        NSDictionary *statusDic = [responseObject valueForKey:@"status"];
        NSString *code = [NSString stringWithFormat:@"%@", [statusDic valueForKey:@"code"]];
        if ([code isEqualToString:@"0"]) {
            NSDictionary *tagDic = [responseObject valueForKey:@"tag"];
            NSLog(@"tagDic = %@", tagDic);
            if ([tagDic isKindOfClass:[NSNull class]]) {
                // 说明为空
               
                [[JiaZaiAnimationHandle shareJiaZaiAnimationHandle] addAlertTitle:@"提示" Content: [NSString stringWithFormat:@"%@目前没有对应的圈子", self.zgwDiseaseOnShiLiBaoGaoModel.name] ToView:self];
            } else {
                NSString *quanZiID = [NSString stringWithFormat:@"%@", [tagDic valueForKey:@"id"]];
                NSLog(@"圈子ID：%@", quanZiID);
            }
        }
    } failure:^(NSURLSessionDataTask *task, NSError *error) {
        [[JiaZaiAnimationHandle shareJiaZaiAnimationHandle] addAlertTitle:@"提示" Content:@"获取圈子信息失败" ToView:self];
    }];
}

#pragma mark - 常见问题
- (void)FAQButton:(UIButton *)button
{
    NSLog(@"常见问题");
    ZGWWebViewController *zgwWebVC = [[ZGWWebViewController alloc] init];
    zgwWebVC.httpUrlString = kZGWFAQUrl;
    [self.navigationController pushViewController:zgwWebVC animated:YES];
}



/*
 #pragma mark - Navigation
 
 // In a storyboard-based application, you will often want to do a little preparation before navigation
 - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
 // Get the new view controller using [segue destinationViewController].
 // Pass the selected object to the new view controller.
 }
 */

@end
